diff --git a/Assets/AddressableAssetsData/AssetGroups/Jelycho Core.asset b/Assets/AddressableAssetsData/AssetGroups/Jelycho Core.asset index 0b668e2..ebff96d 100644 --- a/Assets/AddressableAssetsData/AssetGroups/Jelycho Core.asset +++ b/Assets/AddressableAssetsData/AssetGroups/Jelycho Core.asset @@ -21,12 +21,6 @@ MonoBehaviour: m_SerializedLabels: - world FlaggedDuringContentUpdateRestriction: 0 - - m_GUID: a732f125f8c344a46917f07872c35378 - m_Address: Assets/jelycho/MainMenu/world_main_menu.asset - m_ReadOnly: 0 - m_SerializedLabels: - - world - FlaggedDuringContentUpdateRestriction: 0 - m_GUID: abb7fe7f372ba7640b0ab138239c7f78 m_Address: Assets/jelycho/Main/scn_main_menu.unity m_ReadOnly: 0 diff --git a/Assets/AddressableAssetsData/AssetGroups/game_mode_standard.asset b/Assets/AddressableAssetsData/AssetGroups/game_mode_standard.asset index cf39765..ee76360 100644 --- a/Assets/AddressableAssetsData/AssetGroups/game_mode_standard.asset +++ b/Assets/AddressableAssetsData/AssetGroups/game_mode_standard.asset @@ -14,13 +14,7 @@ MonoBehaviour: m_EditorClassIdentifier: m_GroupName: game_mode_standard m_GUID: a82cff5173833a74787dcac593fe2379 - m_SerializeEntries: - - m_GUID: 09a952812a536084d8f3cd13dc9fec09 - m_Address: gm_standard - m_ReadOnly: 0 - m_SerializedLabels: - - game_mode - FlaggedDuringContentUpdateRestriction: 0 + m_SerializeEntries: [] m_ReadOnly: 0 m_Settings: {fileID: 11400000, guid: 93969247b34433f44bfa755967945828, type: 2} m_SchemaSet: diff --git a/Assets/AddressableAssetsData/Windows/addressables_content_state.bin b/Assets/AddressableAssetsData/Windows/addressables_content_state.bin index abc2699..eefca1e 100644 Binary files a/Assets/AddressableAssetsData/Windows/addressables_content_state.bin and b/Assets/AddressableAssetsData/Windows/addressables_content_state.bin differ diff --git a/Assets/DefaultNetworkPrefabs.asset b/Assets/DefaultNetworkPrefabs.asset new file mode 100644 index 0000000..2f57015 --- /dev/null +++ b/Assets/DefaultNetworkPrefabs.asset @@ -0,0 +1,31 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e651dbb3fbac04af2b8f5abf007ddc23, type: 3} + m_Name: DefaultNetworkPrefabs + m_EditorClassIdentifier: + IsDefault: 1 + List: + - Override: 0 + Prefab: {fileID: 6202808672838313896, guid: d15ca0257a10a034e826a60fba11989b, type: 3} + SourcePrefabToOverride: {fileID: 0} + SourceHashToOverride: 0 + OverridingTargetPrefab: {fileID: 0} + - Override: 0 + Prefab: {fileID: 4105802788753539860, guid: 04a34e58b066c014eaaeb846b2bd3213, type: 3} + SourcePrefabToOverride: {fileID: 0} + SourceHashToOverride: 0 + OverridingTargetPrefab: {fileID: 0} + - Override: 0 + Prefab: {fileID: 6086846679135428685, guid: be292ae0883a3be4090cdc42a4c7c131, type: 3} + SourcePrefabToOverride: {fileID: 0} + SourceHashToOverride: 0 + OverridingTargetPrefab: {fileID: 0} diff --git a/Assets/jelycho/MainMenu/world_main_menu.asset.meta b/Assets/DefaultNetworkPrefabs.asset.meta old mode 100755 new mode 100644 similarity index 79% rename from Assets/jelycho/MainMenu/world_main_menu.asset.meta rename to Assets/DefaultNetworkPrefabs.asset.meta index 74eb048..48e66fd --- a/Assets/jelycho/MainMenu/world_main_menu.asset.meta +++ b/Assets/DefaultNetworkPrefabs.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: a732f125f8c344a46917f07872c35378 +guid: d30094ba881a39a4197e324b492d5db7 NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/Assets/RebootKit b/Assets/RebootKit index 5a813f2..e561647 160000 --- a/Assets/RebootKit +++ b/Assets/RebootKit @@ -1 +1 @@ -Subproject commit 5a813f212c68efd4c00126fc74c38ba2e67d3a68 +Subproject commit e5616474f1139c073de0696489612219c6c74b30 diff --git a/Assets/Resources/TheGame/RealityRebootKit.asset b/Assets/Resources/TheGame/RealityRebootKit.asset index 5020701..553829b 100755 --- a/Assets/Resources/TheGame/RealityRebootKit.asset +++ b/Assets/Resources/TheGame/RealityRebootKit.asset @@ -14,15 +14,11 @@ MonoBehaviour: m_EditorClassIdentifier: initializeOnLoad: 1 coreServices: {fileID: 11400000, guid: f075fa2d60632ae4f9449445a2b794fa, type: 2} - services: [] - gameAsset: {fileID: 11400000, guid: 86b2e13dcab64314e8c5b56c17a956d3, type: 2} - appConfig: - mainMenuConfig: - scene: - m_AssetGUID: abb7fe7f372ba7640b0ab138239c7f78 - m_SubObjectName: - m_SubObjectGUID: - m_SubObjectType: - m_EditorAssetChanged: 0 - gameConfig: - defaultGameMode: {fileID: 11400000, guid: d457791f1b0a8474596c4cd60000debf, type: 2} + gamePrefab: {fileID: 7133476019135208936, guid: 04a34e58b066c014eaaeb846b2bd3213, type: 3} + mainMenuScene: + m_AssetGUID: abb7fe7f372ba7640b0ab138239c7f78 + m_SubObjectName: + m_SubObjectGUID: + m_SubObjectType: + m_EditorAssetChanged: 0 + steamAppID: 480 diff --git a/Assets/jelycho/GameModes.meta b/Assets/Settings/PlayMode.meta old mode 100755 new mode 100644 similarity index 77% rename from Assets/jelycho/GameModes.meta rename to Assets/Settings/PlayMode.meta index dcc6f18..041a819 --- a/Assets/jelycho/GameModes.meta +++ b/Assets/Settings/PlayMode.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 1978d676c19f4164d9a5fb72685a1b41 +guid: 9e044dd355e2bb44a805a56e9b76f26a folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/Settings/PlayMode/Two players test.asset b/Assets/Settings/PlayMode/Two players test.asset new file mode 100644 index 0000000..03332ed --- /dev/null +++ b/Assets/Settings/PlayMode/Two players test.asset @@ -0,0 +1,46 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a689d91966dfb46499fb63f130d9b905, type: 3} + m_Name: Two players test + m_EditorClassIdentifier: + m_Description: + m_EnableEditors: 1 + m_MainEditorInstance: + Name: Main Editor + k__BackingField: Main Editor|0_run + m_Nodes: + - Main Editor|0_run + - Main Editor|0_deploy + m_PlayerTag: + m_InitialScene: {fileID: 0} + m_EditorInstances: + - Name: Player 2 + k__BackingField: Player 2|1_run + m_Nodes: + - Player 2|1_run + - Player 2|1_deploy + m_PlayerTag: + m_InitialScene: {fileID: 0} + m_AdvancedConfiguration: + StreamLogsToMainEditor: 0 + LogsColor: {r: 0.3643, g: 0.581, b: 0.8679, a: 1} + m_LocalInstances: [] + m_RemoteInstances: [] + m_OverridePort: 0 + m_Port: 0 + m_MainEditorInstanceObsolete: + rid: -2 + references: + version: 2 + RefIds: + - rid: -2 + type: {class: , ns: , asm: } diff --git a/Assets/jelycho/GameModes/standard/gm_standard.asset.meta b/Assets/Settings/PlayMode/Two players test.asset.meta old mode 100755 new mode 100644 similarity index 79% rename from Assets/jelycho/GameModes/standard/gm_standard.asset.meta rename to Assets/Settings/PlayMode/Two players test.asset.meta index 8d4a858..f112873 --- a/Assets/jelycho/GameModes/standard/gm_standard.asset.meta +++ b/Assets/Settings/PlayMode/Two players test.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 09a952812a536084d8f3cd13dc9fec09 +guid: f251289f6eaede64c93818c443c26bdc NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/Assets/Settings/UniversalRenderPipelineGlobalSettings.asset b/Assets/Settings/UniversalRenderPipelineGlobalSettings.asset index e8464fd..f3bfd20 100644 --- a/Assets/Settings/UniversalRenderPipelineGlobalSettings.asset +++ b/Assets/Settings/UniversalRenderPipelineGlobalSettings.asset @@ -33,28 +33,28 @@ MonoBehaviour: m_Settings: m_SettingsList: m_List: - - rid: 7613102626737487978 - - rid: 7613102626737487979 + - rid: 7613102744023597192 + - rid: 7613102744023597193 - rid: 6852985685364965378 - rid: 6852985685364965379 - rid: 6852985685364965380 - rid: 6852985685364965381 - - rid: 7613102626737487980 - - rid: 7613102626737487981 + - rid: 7613102744023597194 + - rid: 7613102744023597195 - rid: 6852985685364965384 - rid: 6852985685364965385 - - rid: 7613102626737487982 - - rid: 7613102626737487983 - - rid: 7613102626737487984 - - rid: 7613102626737487985 - - rid: 7613102626737487986 - - rid: 7613102626737487987 + - rid: 7613102744023597196 + - rid: 7613102744023597197 + - rid: 7613102744023597198 + - rid: 7613102744023597199 + - rid: 7613102744023597200 + - rid: 7613102744023597201 - rid: 6852985685364965392 - - rid: 7613102626737487988 + - rid: 7613102744023597202 - rid: 6852985685364965394 - rid: 8712630790384254976 - rid: 260979669776728064 - - rid: 7613102626737487989 + - rid: 7613102744023597203 m_RuntimeSettings: m_List: - rid: 6852985685364965378 @@ -159,14 +159,14 @@ MonoBehaviour: m_version: 0 m_EnableCompilationCaching: 1 m_EnableValidityChecks: 1 - - rid: 7613102626737487978 + - rid: 7613102744023597192 type: {class: URPShaderStrippingSetting, ns: UnityEngine.Rendering.Universal, asm: Unity.RenderPipelines.Universal.Runtime} data: m_Version: 0 m_StripUnusedPostProcessingVariants: 1 m_StripUnusedVariants: 1 m_StripScreenCoordOverrideVariants: 1 - - rid: 7613102626737487979 + - rid: 7613102744023597193 type: {class: UniversalRenderPipelineEditorShaders, ns: UnityEngine.Rendering.Universal, asm: Unity.RenderPipelines.Universal.Runtime} data: m_AutodeskInteractive: {fileID: 4800000, guid: 0e9d5a909a1f7e84882a534d0d11e49f, type: 3} @@ -178,7 +178,7 @@ MonoBehaviour: m_DefaultSpeedTree7Shader: {fileID: 4800000, guid: 0f4122b9a743b744abe2fb6a0a88868b, type: 3} m_DefaultSpeedTree8Shader: {fileID: -6465566751694194690, guid: 9920c1f1781549a46ba081a2a15a16ec, type: 3} m_DefaultSpeedTree9Shader: {fileID: -6465566751694194690, guid: cbd3e1cc4ae141c42a30e33b4d666a61, type: 3} - - rid: 7613102626737487980 + - rid: 7613102744023597194 type: {class: Renderer2DResources, ns: UnityEngine.Rendering.Universal, asm: Unity.RenderPipelines.Universal.Runtime} data: m_Version: 0 @@ -193,7 +193,7 @@ MonoBehaviour: m_DefaultLitMaterial: {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, type: 2} m_DefaultUnlitMaterial: {fileID: 2100000, guid: 9dfc825aed78fcd4ba02077103263b40, type: 2} m_DefaultMaskMaterial: {fileID: 2100000, guid: 15d0c3709176029428a0da2f8cecf0b5, type: 2} - - rid: 7613102626737487981 + - rid: 7613102744023597195 type: {class: UniversalRenderPipelineEditorMaterials, ns: UnityEngine.Rendering.Universal, asm: Unity.RenderPipelines.Universal.Runtime} data: m_DefaultMaterial: {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2} @@ -202,7 +202,7 @@ MonoBehaviour: m_DefaultTerrainMaterial: {fileID: 2100000, guid: 594ea882c5a793440b60ff72d896021e, type: 2} m_DefaultDecalMaterial: {fileID: 2100000, guid: 31d0dcc6f2dd4e4408d18036a2c93862, type: 2} m_DefaultSpriteMaterial: {fileID: 2100000, guid: 9dfc825aed78fcd4ba02077103263b40, type: 2} - - rid: 7613102626737487982 + - rid: 7613102744023597196 type: {class: GPUResidentDrawerResources, ns: UnityEngine.Rendering, asm: Unity.RenderPipelines.GPUDriven.Runtime} data: m_Version: 0 @@ -215,13 +215,13 @@ MonoBehaviour: m_OcclusionCullingDebugKernels: {fileID: 7200000, guid: b23e766bcf50ca4438ef186b174557df, type: 3} m_DebugOcclusionTestPS: {fileID: 4800000, guid: d3f0849180c2d0944bc71060693df100, type: 3} m_DebugOccluderPS: {fileID: 4800000, guid: b3c92426a88625841ab15ca6a7917248, type: 3} - - rid: 7613102626737487983 + - rid: 7613102744023597197 type: {class: STP/RuntimeResources, ns: UnityEngine.Rendering, asm: Unity.RenderPipelines.Core.Runtime} data: m_setupCS: {fileID: 7200000, guid: 33be2e9a5506b2843bdb2bdff9cad5e1, type: 3} m_preTaaCS: {fileID: 7200000, guid: a679dba8ec4d9ce45884a270b0e22dda, type: 3} m_taaCS: {fileID: 7200000, guid: 3923900e2b41b5e47bc25bfdcbcdc9e6, type: 3} - - rid: 7613102626737487984 + - rid: 7613102744023597198 type: {class: ProbeVolumeBakingResources, ns: UnityEngine.Rendering, asm: Unity.RenderPipelines.Core.Runtime} data: m_Version: 1 @@ -234,12 +234,12 @@ MonoBehaviour: skyOcclusionRT: {fileID: -5126288278712620388, guid: 5a2a534753fbdb44e96c3c78b5a6999d, type: 3} renderingLayerCS: {fileID: -6772857160820960102, guid: 94a070d33e408384bafc1dea4a565df9, type: 3} renderingLayerRT: {fileID: -5126288278712620388, guid: 94a070d33e408384bafc1dea4a565df9, type: 3} - - rid: 7613102626737487985 + - rid: 7613102744023597199 type: {class: ProbeVolumeGlobalSettings, ns: UnityEngine.Rendering, asm: Unity.RenderPipelines.Core.Runtime} data: m_Version: 1 m_ProbeVolumeDisableStreamingAssets: 0 - - rid: 7613102626737487986 + - rid: 7613102744023597200 type: {class: ProbeVolumeDebugResources, ns: UnityEngine.Rendering, asm: Unity.RenderPipelines.Core.Runtime} data: m_Version: 1 @@ -249,21 +249,21 @@ MonoBehaviour: probeVolumeOffsetDebugShader: {fileID: 4800000, guid: db8bd7436dc2c5f4c92655307d198381, type: 3} probeSamplingDebugMesh: {fileID: -3555484719484374845, guid: 20be25aac4e22ee49a7db76fb3df6de2, type: 3} numbersDisplayTex: {fileID: 2800000, guid: 73fe53b428c5b3440b7e87ee830b608a, type: 3} - - rid: 7613102626737487987 + - rid: 7613102744023597201 type: {class: IncludeAdditionalRPAssets, ns: UnityEngine.Rendering, asm: Unity.RenderPipelines.Core.Runtime} data: m_version: 0 m_IncludeReferencedInScenes: 0 m_IncludeAssetsByLabel: 0 m_LabelToInclude: - - rid: 7613102626737487988 + - rid: 7613102744023597202 type: {class: ProbeVolumeRuntimeResources, ns: UnityEngine.Rendering, asm: Unity.RenderPipelines.Core.Runtime} data: m_Version: 1 probeVolumeBlendStatesCS: {fileID: 7200000, guid: a3f7b8c99de28a94684cb1daebeccf5d, type: 3} probeVolumeUploadDataCS: {fileID: 7200000, guid: 0951de5992461754fa73650732c4954c, type: 3} probeVolumeUploadDataL2CS: {fileID: 7200000, guid: 6196f34ed825db14b81fb3eb0ea8d931, type: 3} - - rid: 7613102626737487989 + - rid: 7613102744023597203 type: {class: UniversalRenderPipelineEditorAssets, ns: UnityEngine.Rendering.Universal, asm: Unity.RenderPipelines.Universal.Runtime} data: m_DefaultSettingsVolumeProfile: {fileID: 11400000, guid: eda47df5b85f4f249abf7abd73db2cb2, type: 2} diff --git a/Assets/jelycho/Code/Abilities/AbilityAsset.cs b/Assets/jelycho/Code/Abilities/AbilityAsset.cs index c8f3d41..071cb08 100644 --- a/Assets/jelycho/Code/Abilities/AbilityAsset.cs +++ b/Assets/jelycho/Code/Abilities/AbilityAsset.cs @@ -1,4 +1,5 @@ using RebootKit.Engine.Services.Simulation; +using RebootKit.Engine.Simulation; using RebootReality.jelycho.Main; using UnityEngine; @@ -13,7 +14,7 @@ namespace RebootReality.jelycho.Abilities { public void RemoveAbility(AbilityEffect ability) { } - public override void OnTick(float deltaTime) { + public override void Tick(float deltaTime) { } } diff --git a/Assets/jelycho/Code/Beacons/BeaconActor.cs b/Assets/jelycho/Code/Beacons/BeaconActor.cs index fe15eba..caf5e95 100644 --- a/Assets/jelycho/Code/Beacons/BeaconActor.cs +++ b/Assets/jelycho/Code/Beacons/BeaconActor.cs @@ -1,4 +1,5 @@ using RebootKit.Engine.Services.Simulation; +using RebootKit.Engine.Simulation; namespace RebootReality.jelycho.Beacons { public class BeaconActor : Actor { diff --git a/Assets/jelycho/Code/Enemies/ZombieActor.cs b/Assets/jelycho/Code/Enemies/ZombieActor.cs index 7e399ad..2f3e847 100644 --- a/Assets/jelycho/Code/Enemies/ZombieActor.cs +++ b/Assets/jelycho/Code/Enemies/ZombieActor.cs @@ -1,4 +1,5 @@ using RebootKit.Engine.Services.Simulation; +using RebootKit.Engine.Simulation; using RebootReality.jelycho.Main; using UnityEngine; using UnityEngine.AI; diff --git a/Assets/jelycho/Code/GameMode.meta b/Assets/jelycho/Code/GameMode.meta deleted file mode 100755 index 2f6d693..0000000 --- a/Assets/jelycho/Code/GameMode.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 2eebc735c0624eadb3b5fc5a7cc611d7 -timeCreated: 1746878778 \ No newline at end of file diff --git a/Assets/jelycho/Code/GameMode/Standard.meta b/Assets/jelycho/Code/GameMode/Standard.meta deleted file mode 100755 index 058b9ac..0000000 --- a/Assets/jelycho/Code/GameMode/Standard.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 408f07fbb2a14c019e5fc3324a24454c -timeCreated: 1746878783 \ No newline at end of file diff --git a/Assets/jelycho/Code/GameMode/Standard/StandardGameMode.cs b/Assets/jelycho/Code/GameMode/Standard/StandardGameMode.cs deleted file mode 100755 index ded9eb3..0000000 --- a/Assets/jelycho/Code/GameMode/Standard/StandardGameMode.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System; -using System.Threading; -using Cysharp.Threading.Tasks; -using RebootKit.Engine.Foundation; -using RebootKit.Engine.Main; -using RebootKit.Engine.Services.GameMode; -using RebootKit.Engine.Services.Simulation; -using RebootReality.jelycho.Player; -using UnityEngine.AddressableAssets; - -namespace RebootReality.jelycho.GameMode.Standard { - public class StandardGameMode : IGameMode { - [Serializable] - public class Config { - public PlayerControllerAsset playerControllerAsset; - public AssetReferenceGameObject playerPrefab; - - public WorldConfigAsset worldConfig; - } - - Config m_Config; - - [Inject] DIContext m_DIContext; - - CancellationTokenSource m_DisposeCancellationTokenSource = new CancellationTokenSource(); - - ControllersManager m_ControllersManager; - PlayerController m_PlayerController; - - public StandardGameMode(Config config) { - m_Config = config; - - m_ControllersManager = new ControllersManager(m_DisposeCancellationTokenSource.Token); - } - - public async UniTask OnInit(CancellationToken cancellationToken) { - await RR.World.LoadAsync(m_Config.worldConfig.Config, cancellationToken); - - m_ControllersManager.Add(m_Config.playerControllerAsset); - m_PlayerController = m_ControllersManager.Get(); - } - - public void OnStart() { - m_ControllersManager.Start(m_DisposeCancellationTokenSource.Token).Forget(); - } - - public void OnStop() { - m_ControllersManager.Stop(); - } - - public void Dispose() { - m_DisposeCancellationTokenSource.Cancel(); - } - - public void OnTick() { - m_ControllersManager.Tick(); - } - } -} \ No newline at end of file diff --git a/Assets/jelycho/Code/GameMode/Standard/StandardGameMode.cs.meta b/Assets/jelycho/Code/GameMode/Standard/StandardGameMode.cs.meta deleted file mode 100755 index 28c2578..0000000 --- a/Assets/jelycho/Code/GameMode/Standard/StandardGameMode.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 83af58c3064e420687c37222c18c472e -timeCreated: 1746878772 \ No newline at end of file diff --git a/Assets/jelycho/Code/GameMode/Standard/StandardGameModeAsset.cs b/Assets/jelycho/Code/GameMode/Standard/StandardGameModeAsset.cs deleted file mode 100755 index b073bf1..0000000 --- a/Assets/jelycho/Code/GameMode/Standard/StandardGameModeAsset.cs +++ /dev/null @@ -1,14 +0,0 @@ -using RebootKit.Engine.Services.GameMode; -using RebootReality.jelycho.Main; -using UnityEngine; - -namespace RebootReality.jelycho.GameMode.Standard { - [CreateAssetMenu(menuName = GameConsts.k_AddComponentMenu + "Game Modes/Standard")] - public class StandardGameModeAsset : GameModeAsset { - [SerializeField] StandardGameMode.Config m_Config; - - public override IGameMode Create() { - return new StandardGameMode(m_Config); - } - } -} \ No newline at end of file diff --git a/Assets/jelycho/Code/GameMode/Standard/StandardGameModeAsset.cs.meta b/Assets/jelycho/Code/GameMode/Standard/StandardGameModeAsset.cs.meta deleted file mode 100755 index 26e5d3d..0000000 --- a/Assets/jelycho/Code/GameMode/Standard/StandardGameModeAsset.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 1a6162ffd783458ba697dcc1e1c40bea -timeCreated: 1746879123 \ No newline at end of file diff --git a/Assets/jelycho/Code/Main/JelychoGame.cs b/Assets/jelycho/Code/Main/JelychoGame.cs index bc638ef..60c1455 100755 --- a/Assets/jelycho/Code/Main/JelychoGame.cs +++ b/Assets/jelycho/Code/Main/JelychoGame.cs @@ -1,150 +1,168 @@ -using System; -using System.Linq; -using System.Threading; -using Cysharp.Threading.Tasks; -using R3; +using System.Collections.Generic; using RebootKit.Engine.Main; using RebootKit.Engine.Services.Console; -using RebootKit.Engine.Services.Crosshair; -using RebootKit.Engine.Services.GameMode; using RebootKit.Engine.Services.Simulation; +using RebootReality.jelycho.Player; +using Unity.Collections; +using Unity.Netcode; using UnityEngine; +using UnityEngine.Assertions; using Logger = RebootKit.Engine.Foundation.Logger; namespace RebootReality.jelycho.Main { - public static class JelychoConsoleCommands { - [RCCMD("start", "Starts game mode with given name. Usage: start ")] - public static void StartGameMode(string[] args) { - if (args.Length != 3) { - RR.Console.WriteToOutput($"Usage: {args[0]} "); + class PlayerState : INetworkSerializable { + public ulong clientID; + + public PlayerController Controller; + public PlayerActor Actor; + + public void NetworkSerialize(BufferSerializer serializer) where T : IReaderWriter { } + } + + public class JelychoGame : Game { + static readonly Logger s_Logger = new Logger(nameof(JelychoGame)); + + [SerializeField] PlayerController m_PlayerControllerPrefab; + [SerializeField] PlayerActor m_PlayerActorPrefab; + [SerializeField] string m_MainWorldID = "dev"; + + List m_PlayerStates = new List(); + + void Awake() { } + + public override void OnDestroy() { + base.OnDestroy(); + } + + public override void OnNetworkSpawn() { + base.OnNetworkSpawn(); + + NetworkManager.Singleton.OnClientConnectedCallback += OnClientConnected; + NetworkManager.Singleton.OnClientDisconnectCallback += OnClientStopped; + } + + public override void OnNetworkDespawn() { + base.OnNetworkDespawn(); + + NetworkManager.Singleton.OnClientConnectedCallback -= OnClientConnected; + NetworkManager.Singleton.OnClientDisconnectCallback -= OnClientStopped; + } + + void OnClientConnected(ulong clientID) { + s_Logger.Info($"Client {clientID} connected"); + + if (IsServer) { + s_Logger.Info($"Creating player state for client {clientID}"); + + PlayerController controller = Instantiate(m_PlayerControllerPrefab); + controller.name = $"PlayerController_{clientID}"; + controller.NetworkObject.SpawnAsPlayerObject(clientID); + + m_PlayerStates.Add(new PlayerState { + clientID = clientID, + Controller = controller, + }); + } + } + + void OnClientStopped(ulong clientID) { + s_Logger.Info($"Client {clientID} disconnected"); + + if (IsServer) { + for (int i = m_PlayerStates.Count - 1; i >= 0; i--) { + if (m_PlayerStates[i].clientID == clientID) { + s_Logger.Info($"Removing player state for client {clientID}"); + m_PlayerStates.RemoveAtSwapBack(i); + break; + } + } + } + } + + public override void OnWorldLoaded() { + base.OnWorldLoaded(); + + OnPlayerReadyRpc(NetworkManager.Singleton.LocalClientId); + } + + [Rpc(SendTo.Server)] + void OnPlayerReadyRpc(ulong clientID) { + if (!IsServer) { return; } - string worldName = args[2]; - WorldConfigAsset worldConfig = RR.WorldConfigsAssets.FirstOrDefault(t => t.Config.name.Equals(worldName)); - if (worldConfig is null) { - RR.Console.WriteToOutput($"World '{worldName}' not found"); - return; - } + PlayerActor actor = Instantiate(m_PlayerActorPrefab); + actor.name = $"PlayerActor_{clientID}"; + actor.NetworkObject.SpawnAsPlayerObject(clientID); - foreach (GameModeAsset gameModeAsset in RR.GameModesAssets) { - if (gameModeAsset.name == args[1]) { - RR.Console.WriteToOutput($"Starting game mode '{gameModeAsset.name}'"); - RR.StartGameMode(gameModeAsset, worldConfig.Config); - return; + PlayerState playerState = GetPlayerState(clientID); + Assert.IsNotNull(playerState); + playerState.Actor = actor; + playerState.Controller.SetActorClientRpc(actor.NetworkObjectId); + } + + PlayerState GetPlayerState(ulong clientID) { + foreach (PlayerState state in m_PlayerStates) { + if (state.clientID == clientID) { + return state; } } - RR.Console.WriteToOutput($"Game mode '{args[1]}' not found"); + s_Logger.Error($"Player state for client {clientID} not found"); + return null; } - [RCCMD("gamemodes", "Lists all game modes")] - public static void GameModes(string[] args) { - if (args.Length != 1) { - RR.Console.WriteToOutput($"Usage: {args[0]}"); - return; - } + public override void OnWorldUnload() { + base.OnWorldUnload(); - RR.Console.WriteToOutput("Game modes:"); - foreach (GameModeAsset gameModeAsset in RR.GameModesAssets) { - RR.Console.WriteToOutput($" {gameModeAsset.name}"); - } + if (IsServer) { } } - + } + + public static class JelychoConsoleCommands { [RCCMD("worlds", "Lists all worlds")] public static void Worlds(string[] args) { if (args.Length != 1) { - RR.Console.WriteToOutput($"Usage: {args[0]}"); + RR.WriteToConsole($"Usage: {args[0]}"); return; } - RR.Console.WriteToOutput("Worlds:"); + RR.WriteToConsole("Worlds:"); foreach (WorldConfigAsset worldConfigAsset in RR.WorldConfigsAssets) { - RR.Console.WriteToOutput($" {worldConfigAsset.Config.name}"); + RR.WriteToConsole($" {worldConfigAsset.Config.name}"); } } - + [RCCMD("connect", "Connects to a server with given Steam ID. Usage: connect ")] public static void ConnectToServer(string[] args) { - RR.Console.WriteToOutput("Connecting to server..."); - - if (args.Length != 1) { - RR.Console.WriteToOutput($"Usage: {args[0]} "); + if (args.Length < 1 || args.Length > 2) { + RR.WriteToConsole($"Usage: {args[0]} "); return; } - - RR.ConnectToLobby(); + + RR.WriteToConsole("Connecting to server..."); + + // if (args.Length != 2) { + // RR.Console.WriteToOutput($"Usage: {args[0]} "); + // return; + // } + + RR.Connect(); } - + [RCCMD("disconnect", "Disconnects from the current server")] public static void DisconnectFromServer(string[] args) { if (args.Length != 1) { - RR.Console.WriteToOutput($"Usage: {args[0]}"); + RR.WriteToConsole($"Usage: {args[0]}"); return; } RR.Disconnect(); } - } - public class JelychoGame : IGame { - static readonly Logger s_Logger = new Logger(nameof(JelychoGame)); - - [Serializable] - public class Config { - public string mainMenuWorld = "main_menu"; - public string mainGameplayWorld = "dev"; - - public string standardGameMode = "gm_standard"; - } - - readonly Config m_Config; - - DisposableBag m_DisposableBag; - - public JelychoGame(Config config) { - m_Config = config; - m_DisposableBag = new DisposableBag(); - } - - public async UniTask InitAsync(CancellationToken cancellationToken) { - Screen.SetResolution(1600, 900, FullScreenMode.Windowed); - - RR.CreateService(); - await UniTask.Yield(); - } - - public void Run() { - RR.GameModes.ActiveGameMode.Subscribe(gameMode => { - if (gameMode == null) { - RR.Console.WriteToOutput("Game mode stopped, loading main menu world"); - - WorldConfigAsset mainMenuWorldConfigAsset = RR.GetWorldConfigAsset(m_Config.mainMenuWorld); - RR.World.LoadAsync(mainMenuWorldConfigAsset.Config, CancellationToken.None).Forget(); - } - }) - .AddTo(ref m_DisposableBag); - } - - public void Dispose() { - m_DisposableBag.Dispose(); - } - - public void NewGame() { - NewGameAsync().Forget(); - } - - async UniTask NewGameAsync() { - RR.HostServer(); - await UniTask.WaitForSeconds(0.5f); - - s_Logger.Info("Starting new game"); - s_Logger.Info($"Is connected: {RR.IsClient()}"); - s_Logger.Info($"Is host: {RR.IsHost()}"); - - GameModeAsset gameModeAsset = RR.GetGameMode(m_Config.standardGameMode); - WorldConfigAsset worldConfigAsset = RR.GetWorldConfigAsset(m_Config.mainGameplayWorld); - RR.StartGameMode(gameModeAsset, worldConfigAsset.Config); + [RCCMD("version", "Displays the current game version")] + public static void GameVersion(string[] args) { + RR.WriteToConsole($"Game version: {Application.version}"); } } } \ No newline at end of file diff --git a/Assets/jelycho/Code/Main/JelychoGameAsset.cs b/Assets/jelycho/Code/Main/JelychoGameAsset.cs deleted file mode 100755 index 04df14e..0000000 --- a/Assets/jelycho/Code/Main/JelychoGameAsset.cs +++ /dev/null @@ -1,14 +0,0 @@ -using RebootKit.Engine.Main; -using TriInspector; -using UnityEngine; - -namespace RebootReality.jelycho.Main { - [CreateAssetMenu(menuName = GameConsts.k_AddComponentMenu + "Jelycho Game")] - public class JelychoGameAsset : GameAsset { - [SerializeField, InlineProperty, HideLabel] JelychoGame.Config m_Config; - - public override IGame CreateGame() { - return new JelychoGame(m_Config); - } - } -} \ No newline at end of file diff --git a/Assets/jelycho/Code/Main/JelychoGameAsset.cs.meta b/Assets/jelycho/Code/Main/JelychoGameAsset.cs.meta deleted file mode 100755 index 2a857e0..0000000 --- a/Assets/jelycho/Code/Main/JelychoGameAsset.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 6db6aab28280422f92077cf32c409b0f -timeCreated: 1746666083 \ No newline at end of file diff --git a/Assets/jelycho/Code/MainMenu/MainMenuController.cs b/Assets/jelycho/Code/MainMenu/MainMenuController.cs index a7b274a..ad22e05 100755 --- a/Assets/jelycho/Code/MainMenu/MainMenuController.cs +++ b/Assets/jelycho/Code/MainMenu/MainMenuController.cs @@ -22,7 +22,8 @@ namespace RebootReality.jelycho.MainMenu { Button quitButton = root.Q