fixed input controls asset duplication

This commit is contained in:
2025-06-18 17:23:50 +02:00
parent cd3c67419b
commit 7b9470598b
13 changed files with 233 additions and 47 deletions

View File

@@ -66,10 +66,10 @@ namespace RebootReality.jelycho.Main {
public class JelychoGame : IGame {
[Serializable]
public class Config {
public WorldConfigAsset mainMenuWorldConfig;
public GameModeAsset standardGameMode;
public WorldConfigAsset worldAstek;
public string mainMenuWorld = "main_menu";
public string mainGameplayWorld = "dev";
public string standardGameMode = "gm_standard";
}
readonly Config m_Config;
@@ -90,7 +90,9 @@ namespace RebootReality.jelycho.Main {
RR.GameModes.ActiveGameMode.Subscribe(gameMode => {
if (gameMode == null) {
RR.Console.WriteToOutput("Game mode stopped, loading main menu world");
RR.World.LoadAsync(m_Config.mainMenuWorldConfig.Config, CancellationToken.None).Forget();
WorldConfigAsset mainMenuWorldConfigAsset = RR.GetWorldConfigAsset(m_Config.mainMenuWorld);
RR.World.LoadAsync(mainMenuWorldConfigAsset.Config, CancellationToken.None).Forget();
}
})
.AddTo(ref m_DisposableBag);
@@ -101,7 +103,10 @@ namespace RebootReality.jelycho.Main {
}
public void NewGame() {
RR.StartGameMode(m_Config.standardGameMode, m_Config.worldAstek.Config);
GameModeAsset gameModeAsset = RR.GetGameMode(m_Config.standardGameMode);
WorldConfigAsset worldConfigAsset = RR.GetWorldConfigAsset(m_Config.mainGameplayWorld);
RR.StartGameMode(gameModeAsset, worldConfigAsset.Config);
}
}
}

View File

@@ -7,11 +7,14 @@ using Unity.Mathematics;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.InputSystem;
using Logger = RebootKit.Engine.Foundation.Logger;
using Object = UnityEngine.Object;
namespace RebootReality.jelycho.Player {
public class PlayerController : IController {
readonly Logger s_logger = new Logger(nameof(PlayerController));
readonly Config m_Config;
PlayerActor m_FPPActor;
public PlayerController(Config config) {
@@ -32,7 +35,7 @@ namespace RebootReality.jelycho.Player {
m_FPPActor.WarpTo(worldContext.PlayerSpawnPoint.position);
}
await Awaitable.NextFrameAsync(cancellationToken);
await UniTask.Yield(cancellationToken);
}
public void OnStop() {
@@ -44,11 +47,8 @@ namespace RebootReality.jelycho.Player {
}
public void OnTick() {
if (m_FPPActor == null) {
return;
}
if (!Application.isFocused) {
if (m_FPPActor is null) {
s_logger.Error("Player actor is not initialized. Make sure to call OnStart() before OnTick().");
return;
}
@@ -76,7 +76,7 @@ namespace RebootReality.jelycho.Player {
[Serializable]
public class Config {
public AssetReferenceT<GameObject> playerActorPrefab;
public InputActionReference moveActionReference;
public InputActionReference lookActionReference;
public InputActionReference jumpActionReference;
@@ -86,7 +86,7 @@ namespace RebootReality.jelycho.Player {
public InputActionReference secondaryActionReference;
}
}
public static class FPPConfig {
[ConfigVar("fpp.mouse.sens", 0.25f, "Mouse look sensitivity")] public static ConfigVar MouseSensitivity;
[ConfigVar("fpp.mouse.invert.y", 0, "Invert mouse look")] public static ConfigVar MouseInvertY;

View File

@@ -95,7 +95,7 @@
"id": "d67d0677-bbce-4d3c-b135-27accc98bfb1",
"path": "<Gamepad>/rightStick",
"interactions": "",
"processors": "ScaleVector2(x=4)",
"processors": "",
"groups": "",
"action": "Look",
"isComposite": false,

View File

@@ -13,6 +13,6 @@ MonoBehaviour:
m_Name: Jelycho
m_EditorClassIdentifier:
m_Config:
mainMenuWorldConfig: {fileID: 11400000, guid: a732f125f8c344a46917f07872c35378, type: 2}
standardGameMode: {fileID: 11400000, guid: 09a952812a536084d8f3cd13dc9fec09, type: 2}
worldAstek: {fileID: 11400000, guid: 25696e225f604c542bd24bec74319866, type: 2}
mainMenuWorld: main_menu
mainGameplayWorld: dev
standardGameMode: gm_standard

View File

@@ -20,8 +20,8 @@ MonoBehaviour:
m_SubObjectType:
m_EditorAssetChanged: 0
moveActionReference: {fileID: -2772844096359753972, guid: f991e9abd9a53ee4b94b329a5ce96cb2, type: 3}
lookActionReference: {fileID: -5630151704836100654, guid: 052faaac586de48259a63d0c4782560b, type: 3}
jumpActionReference: {fileID: -2099379676528639254, guid: 052faaac586de48259a63d0c4782560b, type: 3}
lookActionReference: {fileID: -5746443703610909298, guid: f991e9abd9a53ee4b94b329a5ce96cb2, type: 3}
jumpActionReference: {fileID: 2789365106649255415, guid: f991e9abd9a53ee4b94b329a5ce96cb2, type: 3}
sprintActionReference: {fileID: 7801716088028601855, guid: f991e9abd9a53ee4b94b329a5ce96cb2, type: 3}
dragObjectActionReference: {fileID: 2331847964233633448, guid: f991e9abd9a53ee4b94b329a5ce96cb2, type: 3}
primaryActionReference: {fileID: 7005240712943983493, guid: f991e9abd9a53ee4b94b329a5ce96cb2, type: 3}

View File

@@ -118,7 +118,7 @@ Material:
m_Colors:
- _BaseColor: {r: 0.062299743, g: 0.3773585, b: 0.14641719, a: 1}
- _Color: {r: 0.06229972, g: 0.37735847, b: 0.14641714, a: 1}
- _EmissionColor: {r: 0, g: 0.71706384, b: 0.07792316, a: 1}
- _EmissionColor: {r: 0, g: 367.1367, b: 39.896656, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
m_BuildTextureStacks: []
m_AllowLocking: 1