diff --git a/RMC DOTS/Samples~/RMC DOTS Game Samples.meta b/RMC DOTS/Samples~/RMC DOTS Game Samples.meta index 85e7c11f..0b7a95aa 100644 --- a/RMC DOTS/Samples~/RMC DOTS Game Samples.meta +++ b/RMC DOTS/Samples~/RMC DOTS Game Samples.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: bc89051f9eaf3cd41b2bbaab37e9b003 +guid: 2c44bf0233f04c44cb80b7173d7d1c2c folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/RMC DOTS/Samples~/RMC DOTS Game Samples/Games/Pong2D/Pong2D_Version02_DOTS/Prefabs/Projectile.prefab b/RMC DOTS/Samples~/RMC DOTS Game Samples/Games/Pong2D/Pong2D_Version02_DOTS/Prefabs/Projectile.prefab index 1b7eaeed..a62790cf 100644 --- a/RMC DOTS/Samples~/RMC DOTS Game Samples/Games/Pong2D/Pong2D_Version02_DOTS/Prefabs/Projectile.prefab +++ b/RMC DOTS/Samples~/RMC DOTS Game Samples/Games/Pong2D/Pong2D_Version02_DOTS/Prefabs/Projectile.prefab @@ -149,10 +149,10 @@ MonoBehaviour: m_EditorClassIdentifier: MemberOfLayerMask: serializedVersion: 2 - m_Bits: 128 + m_Bits: 256 CollidesWithLayerMask: serializedVersion: 2 - m_Bits: 64 + m_Bits: 512 CanBeNegative: 1 MinForce: {x: 11, y: 11, z: 0} MaxForce: {x: 11, y: 11, z: 0} diff --git a/RMC DOTS/Samples~/RMC DOTS Game Samples/Games/Pong2D/Pong2D_Version02_DOTS/Scenes/SubScenes/Pong2D_Version02_DOTS_SubScene.unity b/RMC DOTS/Samples~/RMC DOTS Game Samples/Games/Pong2D/Pong2D_Version02_DOTS/Scenes/SubScenes/Pong2D_Version02_DOTS_SubScene.unity index 3dc13aec..c35de716 100644 --- a/RMC DOTS/Samples~/RMC DOTS Game Samples/Games/Pong2D/Pong2D_Version02_DOTS/Scenes/SubScenes/Pong2D_Version02_DOTS_SubScene.unity +++ b/RMC DOTS/Samples~/RMC DOTS Game Samples/Games/Pong2D/Pong2D_Version02_DOTS/Scenes/SubScenes/Pong2D_Version02_DOTS_SubScene.unity @@ -604,10 +604,10 @@ MonoBehaviour: m_EditorClassIdentifier: MemberOfLayerMask: serializedVersion: 2 - m_Bits: 64 + m_Bits: 512 CollidesWithLayerMask: serializedVersion: 2 - m_Bits: 128 + m_Bits: 256 --- !u!1 &1370772493 GameObject: m_ObjectHideFlags: 0 @@ -1524,10 +1524,10 @@ MonoBehaviour: m_EditorClassIdentifier: MemberOfLayerMask: serializedVersion: 2 - m_Bits: 64 + m_Bits: 512 CollidesWithLayerMask: serializedVersion: 2 - m_Bits: 128 + m_Bits: 256 --- !u!1660057539 &9223372036854775807 SceneRoots: m_ObjectHideFlags: 0 diff --git a/RMC DOTS/Samples~/RMC DOTS Game Samples/Games/Pong2D/Pong2D_Version02_DOTS/Scripts/Runtime/Paddle/Human/PaddleHumanMoveSystem.cs b/RMC DOTS/Samples~/RMC DOTS Game Samples/Games/Pong2D/Pong2D_Version02_DOTS/Scripts/Runtime/Paddle/Human/PaddleHumanMoveSystem.cs index 8c582b6d..7061ab8c 100644 --- a/RMC DOTS/Samples~/RMC DOTS Game Samples/Games/Pong2D/Pong2D_Version02_DOTS/Scripts/Runtime/Paddle/Human/PaddleHumanMoveSystem.cs +++ b/RMC DOTS/Samples~/RMC DOTS Game Samples/Games/Pong2D/Pong2D_Version02_DOTS/Scripts/Runtime/Paddle/Human/PaddleHumanMoveSystem.cs @@ -20,14 +20,29 @@ public void OnCreate(ref SystemState state) [BurstCompile] public void OnUpdate(ref SystemState state) { - float2 inputComponentMove = SystemAPI.GetSingleton().Move; + // First get the current input value from the PlayerMoveInput component. This component is set in the + // GetPlayerInputSystem that runs earlier in the frame. + float2 move = SystemAPI.GetSingleton().Move; + float2 look = SystemAPI.GetSingleton().Look; float deltaTime = SystemAPI.Time.DeltaTime; - + float2 moveComposite = float2.zero; + + // Here we support EITHER look or move to move around + // Prioritize MOVE, if no MOVE is set, then use look + if (move.y != 0) + { + moveComposite.y = move.y; + } + else + { + moveComposite.y = look.y; + } + foreach (var (velocity, mass, paddleMoveComponent) in SystemAPI.Query,PhysicsMass, PaddleMoveComponent>().WithAll()) { // Only move in the y - float currentMoveInput = inputComponentMove.y * paddleMoveComponent.Value * deltaTime; + float currentMoveInput = moveComposite.y * paddleMoveComponent.Value * deltaTime; velocity.ValueRW.Linear.y = velocity.ValueRW.Linear.x + currentMoveInput; } } diff --git a/RMC DOTS/Samples~/RMC DOTS Game Samples/Games/Pong2D/Pong2D_Version02_DOTS/Scripts/Runtime/Paddle/PaddleMoveAuthoring.cs b/RMC DOTS/Samples~/RMC DOTS Game Samples/Games/Pong2D/Pong2D_Version02_DOTS/Scripts/Runtime/Paddle/PaddleMoveAuthoring.cs index 507144f4..6e5bb329 100644 --- a/RMC DOTS/Samples~/RMC DOTS Game Samples/Games/Pong2D/Pong2D_Version02_DOTS/Scripts/Runtime/Paddle/PaddleMoveAuthoring.cs +++ b/RMC DOTS/Samples~/RMC DOTS Game Samples/Games/Pong2D/Pong2D_Version02_DOTS/Scripts/Runtime/Paddle/PaddleMoveAuthoring.cs @@ -1,5 +1,4 @@ using Unity.Entities; -using Unity.Physics; using UnityEngine; namespace RMC.DOTS.Samples.Pong2D.Pong2D_Version02_DOTS @@ -36,8 +35,4 @@ public override void Bake(PaddleMoveAuthoring authoring) AddComponent(entity, new PaddleMoveComponent { Value = authoring.Speed }); } } - - public class FixedList128 - { - } } \ No newline at end of file diff --git a/RMC DOTS/Samples~/RMC DOTS Game Samples/Games/Pong2D/Pong2D_Version02_DOTS/Scripts/Runtime/Pong2D_Version02_DOTS.cs b/RMC DOTS/Samples~/RMC DOTS Game Samples/Games/Pong2D/Pong2D_Version02_DOTS/Scripts/Runtime/Pong2D_Version02_DOTS.cs index 2369c44d..d822441d 100644 --- a/RMC DOTS/Samples~/RMC DOTS Game Samples/Games/Pong2D/Pong2D_Version02_DOTS/Scripts/Runtime/Pong2D_Version02_DOTS.cs +++ b/RMC DOTS/Samples~/RMC DOTS Game Samples/Games/Pong2D/Pong2D_Version02_DOTS/Scripts/Runtime/Pong2D_Version02_DOTS.cs @@ -61,6 +61,26 @@ public bool IsEnabledSimulationSystemGroup // Unity Methods -------------------------------- protected async void Start() { + //Make sure the project has layers set properly + var projectileName = "Projectile"; + var projectileIndexCurrent = LayerMask.NameToLayer(projectileName); + var projectileIndexRequired = 8; + + if (projectileIndexCurrent != projectileIndexRequired) + { + Debug.Log($"LayerMask failed. Must set Layer {projectileIndexRequired} to be '{projectileName}'."); + } + + var goalName = "Goal"; + var goalIndexCurrent = LayerMask.NameToLayer(goalName); + var goalIndexRequired = 9; + + if (goalIndexCurrent != goalIndexRequired) + { + Debug.Log($"LayerMask failed. Must set Layer {goalIndexRequired} to be '{goalName}'."); + } + + // ECS _ecsWorld = await DOTSUtility.GetWorldAsync(_subScene); // Game State diff --git a/RMC DOTS/Samples~/RMC DOTS Game Samples/Games/RollABall3D/RollABall3D_Version02_DOTS/Scenes/SubScenes/RollABall3D_Version02_DOTS_SubScene.unity b/RMC DOTS/Samples~/RMC DOTS Game Samples/Games/RollABall3D/RollABall3D_Version02_DOTS/Scenes/SubScenes/RollABall3D_Version02_DOTS_SubScene.unity index df0c1397..2da2b485 100644 --- a/RMC DOTS/Samples~/RMC DOTS Game Samples/Games/RollABall3D/RollABall3D_Version02_DOTS/Scenes/SubScenes/RollABall3D_Version02_DOTS_SubScene.unity +++ b/RMC DOTS/Samples~/RMC DOTS Game Samples/Games/RollABall3D/RollABall3D_Version02_DOTS/Scenes/SubScenes/RollABall3D_Version02_DOTS_SubScene.unity @@ -1476,10 +1476,10 @@ MonoBehaviour: m_EditorClassIdentifier: MemberOfLayerMask: serializedVersion: 2 - m_Bits: 256 + m_Bits: 128 CollidesWithLayerMask: serializedVersion: 2 - m_Bits: 512 + m_Bits: 64 --- !u!65 &1535103198781836437 BoxCollider: m_ObjectHideFlags: 0 @@ -1544,10 +1544,10 @@ MonoBehaviour: m_EditorClassIdentifier: MemberOfLayerMask: serializedVersion: 2 - m_Bits: 256 + m_Bits: 128 CollidesWithLayerMask: serializedVersion: 2 - m_Bits: 512 + m_Bits: 64 --- !u!54 &1595757792512350425 Rigidbody: m_ObjectHideFlags: 0 @@ -1711,10 +1711,10 @@ MonoBehaviour: m_EditorClassIdentifier: MemberOfLayerMask: serializedVersion: 2 - m_Bits: 512 + m_Bits: 64 CollidesWithLayerMask: serializedVersion: 2 - m_Bits: 256 + m_Bits: 128 --- !u!114 &1595757792512350436 MonoBehaviour: m_ObjectHideFlags: 0 @@ -1791,10 +1791,10 @@ MonoBehaviour: m_EditorClassIdentifier: MemberOfLayerMask: serializedVersion: 2 - m_Bits: 256 + m_Bits: 128 CollidesWithLayerMask: serializedVersion: 2 - m_Bits: 512 + m_Bits: 64 --- !u!65 &1799974725487586352 BoxCollider: m_ObjectHideFlags: 0 @@ -1995,10 +1995,10 @@ MonoBehaviour: m_EditorClassIdentifier: MemberOfLayerMask: serializedVersion: 2 - m_Bits: 256 + m_Bits: 128 CollidesWithLayerMask: serializedVersion: 2 - m_Bits: 512 + m_Bits: 64 --- !u!23 &2164273666026434707 MeshRenderer: m_ObjectHideFlags: 0 @@ -2157,10 +2157,10 @@ MonoBehaviour: m_EditorClassIdentifier: MemberOfLayerMask: serializedVersion: 2 - m_Bits: 256 + m_Bits: 128 CollidesWithLayerMask: serializedVersion: 2 - m_Bits: 512 + m_Bits: 64 --- !u!4 &2531862161484313402 Transform: m_ObjectHideFlags: 0 @@ -2449,10 +2449,10 @@ MonoBehaviour: m_EditorClassIdentifier: MemberOfLayerMask: serializedVersion: 2 - m_Bits: 256 + m_Bits: 128 CollidesWithLayerMask: serializedVersion: 2 - m_Bits: 512 + m_Bits: 64 --- !u!54 &2870685621814594093 Rigidbody: m_ObjectHideFlags: 0 @@ -2523,10 +2523,10 @@ MonoBehaviour: m_EditorClassIdentifier: MemberOfLayerMask: serializedVersion: 2 - m_Bits: 256 + m_Bits: 128 CollidesWithLayerMask: serializedVersion: 2 - m_Bits: 512 + m_Bits: 64 --- !u!54 &2957341238397316333 Rigidbody: m_ObjectHideFlags: 0 @@ -2706,10 +2706,10 @@ MonoBehaviour: m_EditorClassIdentifier: MemberOfLayerMask: serializedVersion: 2 - m_Bits: 256 + m_Bits: 128 CollidesWithLayerMask: serializedVersion: 2 - m_Bits: 512 + m_Bits: 64 --- !u!33 &3465807237584622645 MeshFilter: m_ObjectHideFlags: 0 @@ -2889,10 +2889,10 @@ MonoBehaviour: m_EditorClassIdentifier: MemberOfLayerMask: serializedVersion: 2 - m_Bits: 256 + m_Bits: 128 CollidesWithLayerMask: serializedVersion: 2 - m_Bits: 512 + m_Bits: 64 --- !u!65 &4663230611700336597 BoxCollider: m_ObjectHideFlags: 0 @@ -3072,10 +3072,10 @@ MonoBehaviour: m_EditorClassIdentifier: MemberOfLayerMask: serializedVersion: 2 - m_Bits: 256 + m_Bits: 128 CollidesWithLayerMask: serializedVersion: 2 - m_Bits: 512 + m_Bits: 64 --- !u!65 &6507408694181100263 BoxCollider: m_ObjectHideFlags: 0 @@ -3255,10 +3255,10 @@ MonoBehaviour: m_EditorClassIdentifier: MemberOfLayerMask: serializedVersion: 2 - m_Bits: 256 + m_Bits: 128 CollidesWithLayerMask: serializedVersion: 2 - m_Bits: 512 + m_Bits: 64 --- !u!54 &6993958944624095650 Rigidbody: m_ObjectHideFlags: 0 @@ -3465,10 +3465,10 @@ MonoBehaviour: m_EditorClassIdentifier: MemberOfLayerMask: serializedVersion: 2 - m_Bits: 256 + m_Bits: 128 CollidesWithLayerMask: serializedVersion: 2 - m_Bits: 512 + m_Bits: 64 --- !u!1660057539 &9223372036854775807 SceneRoots: m_ObjectHideFlags: 0 diff --git a/RMC DOTS/Samples~/RMC DOTS Game Samples/Games/RollABall3D/RollABall3D_Version02_DOTS/Scripts/Runtime/Player/PlayerMove/PlayerMoveSystem.cs b/RMC DOTS/Samples~/RMC DOTS Game Samples/Games/RollABall3D/RollABall3D_Version02_DOTS/Scripts/Runtime/Player/PlayerMove/PlayerMoveSystem.cs index bbbe0888..e59e7410 100644 --- a/RMC DOTS/Samples~/RMC DOTS Game Samples/Games/RollABall3D/RollABall3D_Version02_DOTS/Scripts/Runtime/Player/PlayerMove/PlayerMoveSystem.cs +++ b/RMC DOTS/Samples~/RMC DOTS Game Samples/Games/RollABall3D/RollABall3D_Version02_DOTS/Scripts/Runtime/Player/PlayerMove/PlayerMoveSystem.cs @@ -25,18 +25,36 @@ public void OnUpdate(ref SystemState state) { // First get the current input value from the PlayerMoveInput component. This component is set in the // GetPlayerInputSystem that runs earlier in the frame. - float2 inputComponentMove = SystemAPI.GetSingleton().Move; + float2 move = SystemAPI.GetSingleton().Move; + float2 look = SystemAPI.GetSingleton().Look; float deltaTime = SystemAPI.Time.DeltaTime; + float2 moveComposite = float2.zero; + + // Here we support EITHER look or move to move around + // Prioritize MOVE, if no MOVE is set, then use look + if (move.x != 0) + { + moveComposite.x = move.x; + } + else + { + moveComposite.x = look.x; + } - // Although there is only one player in the game world, we still define systems as if we were executing over - // a group of players. Inside this idiomatic foreach, we apply force to the player based off the current - // move input and the force strength. - foreach (var (velocity, mass, moveForce) in + if (move.y != 0) + { + moveComposite.y = move.y; + } + else + { + moveComposite.y = look.y; + } + + foreach (var (physicsVelocity, mass, playerMoveComponent) in SystemAPI.Query,PhysicsMass, PlayerMoveComponent>().WithAll()) { - float3 moveInput3d = new float3(inputComponentMove.x, 0f, inputComponentMove.y); - float3 currentMoveInput = moveInput3d * moveForce.Value * deltaTime; - velocity.ValueRW.ApplyLinearImpulse(in mass, currentMoveInput); + float3 moveComposite3D = new float3(moveComposite.x, 0f, moveComposite.y) * (deltaTime * playerMoveComponent.Value); + physicsVelocity.ValueRW.ApplyLinearImpulse(in mass, moveComposite3D); } } } diff --git a/RMC DOTS/Samples~/RMC DOTS Game Samples/Games/RollABall3D/RollABall3D_Version02_DOTS/Scripts/Runtime/RollABall3D_Version02_DOTS.cs b/RMC DOTS/Samples~/RMC DOTS Game Samples/Games/RollABall3D/RollABall3D_Version02_DOTS/Scripts/Runtime/RollABall3D_Version02_DOTS.cs index 86669f60..288286c6 100644 --- a/RMC DOTS/Samples~/RMC DOTS Game Samples/Games/RollABall3D/RollABall3D_Version02_DOTS/Scripts/Runtime/RollABall3D_Version02_DOTS.cs +++ b/RMC DOTS/Samples~/RMC DOTS Game Samples/Games/RollABall3D/RollABall3D_Version02_DOTS/Scripts/Runtime/RollABall3D_Version02_DOTS.cs @@ -58,6 +58,26 @@ public bool IsEnabledSimulationSystemGroup // Unity Methods -------------------------------- protected async void Start() { + //Make sure the project has layers set properly + var playerName = "Player"; + var playerIndexCurrent = LayerMask.NameToLayer(playerName); + var playerIndexRequired = 6; + + if (playerIndexCurrent != playerIndexRequired) + { + Debug.Log($"LayerMask failed. Must set Layer {playerIndexRequired} to be '{playerName}'."); + } + + var pickupName = "Pickup"; + var pickupIndexCurrent = LayerMask.NameToLayer(pickupName); + var pickupIndexRequired = 7; + + if (pickupIndexCurrent != pickupIndexRequired) + { + Debug.Log($"LayerMask failed. Must set Layer {pickupIndexRequired} to be '{pickupName}'."); + } + + // ECS _ecsWorld = await DOTSUtility.GetWorldAsync(_subScene); // Game State diff --git a/RMC DOTS/Samples~/RMC DOTS Game Templates.meta b/RMC DOTS/Samples~/RMC DOTS Game Templates.meta index a0cad44d..90f7a03c 100644 --- a/RMC DOTS/Samples~/RMC DOTS Game Templates.meta +++ b/RMC DOTS/Samples~/RMC DOTS Game Templates.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: e16b31fe702aa7d4ebdf296a0c9297c6 +guid: 5a41595b6ba632045add14d665c05145 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scenes/SubScenes/DOTSGameTemplate_SubScene.unity b/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scenes/SubScenes/DOTSGameTemplate_SubScene.unity index 665caade..1e73e83f 100644 --- a/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scenes/SubScenes/DOTSGameTemplate_SubScene.unity +++ b/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scenes/SubScenes/DOTSGameTemplate_SubScene.unity @@ -407,10 +407,10 @@ MonoBehaviour: m_EditorClassIdentifier: MemberOfLayerMask: serializedVersion: 2 - m_Bits: 64 + m_Bits: 512 CollidesWithLayerMask: serializedVersion: 2 - m_Bits: 512 + m_Bits: 64 --- !u!1 &1231068289 GameObject: m_ObjectHideFlags: 0 @@ -1145,10 +1145,10 @@ MonoBehaviour: m_EditorClassIdentifier: MemberOfLayerMask: serializedVersion: 2 - m_Bits: 512 + m_Bits: 64 CollidesWithLayerMask: serializedVersion: 2 - m_Bits: 64 + m_Bits: 512 --- !u!114 &2141468202 MonoBehaviour: m_ObjectHideFlags: 0 diff --git a/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/DOTSTemplate.cs b/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/DOTSTemplate.cs index 045b1874..cce624f9 100644 --- a/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/DOTSTemplate.cs +++ b/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/DOTSTemplate.cs @@ -57,6 +57,26 @@ public bool IsEnabledSimulationSystemGroup // Unity Methods -------------------------------- protected async void Start() { + //Make sure the project has layers set properly + var playerName = "Player"; + var playerIndexCurrent = LayerMask.NameToLayer(playerName); + var playerIndexRequired = 6; + + if (playerIndexCurrent != playerIndexRequired) + { + Debug.Log($"LayerMask failed. Must set Layer {playerIndexRequired} to be '{playerName}'."); + } + + var goalName = "Goal"; + var goalIndexCurrent = LayerMask.NameToLayer(goalName); + var goalIndexRequired = 9; + + if (goalIndexCurrent != goalIndexRequired) + { + Debug.Log($"LayerMask failed. Must set Layer {goalIndexRequired} to be '{goalName}'."); + } + + // ECS _ecsWorld = await DOTSUtility.GetWorldAsync(_subScene); // Game State diff --git a/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Gameplay.meta b/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Gameplay.meta new file mode 100644 index 00000000..58097730 --- /dev/null +++ b/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Gameplay.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5f7ee82e071b8fc4cada61f1a30c8515 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Player/GoalWasReached.meta b/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Gameplay/GoalWasReached.meta similarity index 100% rename from RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Player/GoalWasReached.meta rename to RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Gameplay/GoalWasReached.meta diff --git a/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Player/GoalWasReached/GoalWasReachedAudioSystem.cs b/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Gameplay/GoalWasReached/GoalWasReachedAudioSystem.cs similarity index 100% rename from RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Player/GoalWasReached/GoalWasReachedAudioSystem.cs rename to RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Gameplay/GoalWasReached/GoalWasReachedAudioSystem.cs diff --git a/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Player/GoalWasReached/GoalWasReachedAudioSystem.cs.meta b/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Gameplay/GoalWasReached/GoalWasReachedAudioSystem.cs.meta similarity index 100% rename from RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Player/GoalWasReached/GoalWasReachedAudioSystem.cs.meta rename to RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Gameplay/GoalWasReached/GoalWasReachedAudioSystem.cs.meta diff --git a/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Player/GoalWasReached/GoalWasReachedResetSystem.cs b/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Gameplay/GoalWasReached/GoalWasReachedResetSystem.cs similarity index 100% rename from RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Player/GoalWasReached/GoalWasReachedResetSystem.cs rename to RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Gameplay/GoalWasReached/GoalWasReachedResetSystem.cs diff --git a/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Player/GoalWasReached/GoalWasReachedResetSystem.cs.meta b/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Gameplay/GoalWasReached/GoalWasReachedResetSystem.cs.meta similarity index 100% rename from RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Player/GoalWasReached/GoalWasReachedResetSystem.cs.meta rename to RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Gameplay/GoalWasReached/GoalWasReachedResetSystem.cs.meta diff --git a/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Player/GoalWasReached/GoalWasReachedScoreSystem.cs b/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Gameplay/GoalWasReached/GoalWasReachedScoreSystem.cs similarity index 100% rename from RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Player/GoalWasReached/GoalWasReachedScoreSystem.cs rename to RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Gameplay/GoalWasReached/GoalWasReachedScoreSystem.cs diff --git a/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Player/GoalWasReached/GoalWasReachedScoreSystem.cs.meta b/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Gameplay/GoalWasReached/GoalWasReachedScoreSystem.cs.meta similarity index 100% rename from RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Player/GoalWasReached/GoalWasReachedScoreSystem.cs.meta rename to RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Gameplay/GoalWasReached/GoalWasReachedScoreSystem.cs.meta diff --git a/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Player/GoalWasReached/GoalWasReachedSystem.cs b/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Gameplay/GoalWasReached/GoalWasReachedSystem.cs similarity index 100% rename from RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Player/GoalWasReached/GoalWasReachedSystem.cs rename to RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Gameplay/GoalWasReached/GoalWasReachedSystem.cs diff --git a/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Player/GoalWasReached/GoalWasReachedSystem.cs.meta b/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Gameplay/GoalWasReached/GoalWasReachedSystem.cs.meta similarity index 100% rename from RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Player/GoalWasReached/GoalWasReachedSystem.cs.meta rename to RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Gameplay/GoalWasReached/GoalWasReachedSystem.cs.meta diff --git a/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Player/GoalWasReached/GoalWasReachedSystemAuthoring.cs b/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Gameplay/GoalWasReached/GoalWasReachedSystemAuthoring.cs similarity index 100% rename from RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Player/GoalWasReached/GoalWasReachedSystemAuthoring.cs rename to RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Gameplay/GoalWasReached/GoalWasReachedSystemAuthoring.cs diff --git a/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Player/GoalWasReached/GoalWasReachedSystemAuthoring.cs.meta b/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Gameplay/GoalWasReached/GoalWasReachedSystemAuthoring.cs.meta similarity index 100% rename from RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Player/GoalWasReached/GoalWasReachedSystemAuthoring.cs.meta rename to RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Gameplay/GoalWasReached/GoalWasReachedSystemAuthoring.cs.meta diff --git a/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Player/GoalWasReached/GoalWasReachedTag.cs b/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Gameplay/GoalWasReached/GoalWasReachedTag.cs similarity index 100% rename from RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Player/GoalWasReached/GoalWasReachedTag.cs rename to RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Gameplay/GoalWasReached/GoalWasReachedTag.cs diff --git a/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Player/GoalWasReached/GoalWasReachedTag.cs.meta b/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Gameplay/GoalWasReached/GoalWasReachedTag.cs.meta similarity index 100% rename from RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Player/GoalWasReached/GoalWasReachedTag.cs.meta rename to RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Gameplay/GoalWasReached/GoalWasReachedTag.cs.meta diff --git a/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Move/MoveComponentAuthoring.cs b/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Move/MoveComponentAuthoring.cs deleted file mode 100644 index e9dc212c..00000000 --- a/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Move/MoveComponentAuthoring.cs +++ /dev/null @@ -1,21 +0,0 @@ -using Unity.Entities; -using UnityEngine; - -namespace RMC.DOTS.Samples.Templates.DOTSGameTemplate -{ - public class MoveComponentAuthoring : MonoBehaviour - { - public float Speed = 7.5f; - - public class MoveComponentAuthoringBaker : Baker - { - public override void Bake(MoveComponentAuthoring authoring) - { - Entity entity = GetEntity(TransformUsageFlags.Dynamic); - - AddComponent(entity, - new MoveComponent { Value = authoring.Speed }); - } - } - } -} \ No newline at end of file diff --git a/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Move/MoveSystem.cs b/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Move/MoveSystem.cs deleted file mode 100644 index 4b765cd0..00000000 --- a/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Move/MoveSystem.cs +++ /dev/null @@ -1,43 +0,0 @@ -using RMC.DOTS.SystemGroups; -using RMC.DOTS.Systems.Input; -using RMC.DOTS.Systems.Player; -using Unity.Burst; -using Unity.Entities; -using Unity.Mathematics; -using Unity.Physics; -using Unity.Physics.Extensions; - -namespace RMC.DOTS.Samples.Templates.DOTSGameTemplate -{ - /// - /// This system moves the player in 3D space. - /// - [UpdateInGroup(typeof(PauseableSystemGroup))] - public partial struct MoveSystem : ISystem - { - public void OnCreate(ref SystemState state) - { - state.RequireForUpdate(); - } - - [BurstCompile] - public void OnUpdate(ref SystemState state) - { - // First get the current input value from the PlayerMoveInput component. This component is set in the - // GetPlayerInputSystem that runs earlier in the frame. - float2 inputComponentMove = SystemAPI.GetSingleton().Move; - float deltaTime = SystemAPI.Time.DeltaTime; - - // Although there is only one player in the game world, we still define systems as if we were executing over - // a group of players. Inside this idiomatic foreach, we apply force to the player based off the current - // move input and the force strength. - foreach (var (velocity, mass, moveForce) in - SystemAPI.Query,PhysicsMass, MoveComponent>().WithAll()) - { - float3 moveInput3d = new float3(inputComponentMove.x, 0f, inputComponentMove.y); - float3 currentMoveInput = moveInput3d * moveForce.Value * deltaTime; - velocity.ValueRW.ApplyLinearImpulse(in mass, currentMoveInput); - } - } - } -} \ No newline at end of file diff --git a/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Move.meta b/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Player/Move.meta similarity index 100% rename from RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Move.meta rename to RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Player/Move.meta diff --git a/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Move/MoveComponent.cs b/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Player/Move/PlayerMoveComponent.cs similarity index 69% rename from RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Move/MoveComponent.cs rename to RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Player/Move/PlayerMoveComponent.cs index 15e57ea8..69066e41 100644 --- a/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Move/MoveComponent.cs +++ b/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Player/Move/PlayerMoveComponent.cs @@ -2,7 +2,7 @@ namespace RMC.DOTS.Samples.Templates.DOTSGameTemplate { - public struct MoveComponent : IComponentData + public struct PlayerMoveComponent : IComponentData { public float Value; } diff --git a/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Move/MoveComponent.cs.meta b/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Player/Move/PlayerMoveComponent.cs.meta similarity index 100% rename from RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Move/MoveComponent.cs.meta rename to RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Player/Move/PlayerMoveComponent.cs.meta diff --git a/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Player/Move/PlayerMoveComponentAuthoring.cs b/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Player/Move/PlayerMoveComponentAuthoring.cs new file mode 100644 index 00000000..b9bbd087 --- /dev/null +++ b/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Player/Move/PlayerMoveComponentAuthoring.cs @@ -0,0 +1,21 @@ +using Unity.Entities; +using UnityEngine; + +namespace RMC.DOTS.Samples.Templates.DOTSGameTemplate +{ + public class PlayerMoveComponentAuthoring : MonoBehaviour + { + public float Speed = 7.5f; + + public class PlayerMoveComponentAuthoringBaker : Baker + { + public override void Bake(PlayerMoveComponentAuthoring authoring) + { + Entity entity = GetEntity(TransformUsageFlags.Dynamic); + + AddComponent(entity, + new PlayerMoveComponent { Value = authoring.Speed }); + } + } + } +} \ No newline at end of file diff --git a/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Move/MoveComponentAuthoring.cs.meta b/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Player/Move/PlayerMoveComponentAuthoring.cs.meta similarity index 100% rename from RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Move/MoveComponentAuthoring.cs.meta rename to RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Player/Move/PlayerMoveComponentAuthoring.cs.meta diff --git a/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Player/Move/PlayerMoveSystem.cs b/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Player/Move/PlayerMoveSystem.cs new file mode 100644 index 00000000..1610f5a8 --- /dev/null +++ b/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Player/Move/PlayerMoveSystem.cs @@ -0,0 +1,61 @@ +using RMC.DOTS.SystemGroups; +using RMC.DOTS.Systems.Input; +using RMC.DOTS.Systems.Player; +using Unity.Burst; +using Unity.Entities; +using Unity.Mathematics; +using Unity.Physics; +using Unity.Physics.Extensions; + +namespace RMC.DOTS.Samples.Templates.DOTSGameTemplate +{ + /// + /// This system moves the player in 3D space. + /// + [UpdateInGroup(typeof(PauseableSystemGroup))] + public partial struct PlayerMoveSystem : ISystem + { + public void OnCreate(ref SystemState state) + { + state.RequireForUpdate(); + } + + [BurstCompile] + public void OnUpdate(ref SystemState state) + { + // First get the current input value from the PlayerMoveInput component. This component is set in the + // GetPlayerInputSystem that runs earlier in the frame. + float2 move = SystemAPI.GetSingleton().Move; + float2 look = SystemAPI.GetSingleton().Look; + float deltaTime = SystemAPI.Time.DeltaTime; + float2 moveComposite = float2.zero; + + // Here we support EITHER look or move to move around + // Prioritize MOVE, if no MOVE is set, then use look + if (move.x != 0) + { + moveComposite.x = move.x; + } + else + { + moveComposite.x = look.x; + } + + if (move.y != 0) + { + moveComposite.y = move.y; + } + else + { + moveComposite.y = look.y; + } + + foreach (var (physicsVelocity, mass, playerMoveComponent) in + SystemAPI.Query,PhysicsMass, PlayerMoveComponent>().WithAll()) + { + float3 moveComposite3D = new float3(moveComposite.x, 0f, moveComposite.y) * (deltaTime * playerMoveComponent.Value); + physicsVelocity.ValueRW.ApplyLinearImpulse(in mass, moveComposite3D); + } + } + } +} \ No newline at end of file diff --git a/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Move/MoveSystem.cs.meta b/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Player/Move/PlayerMoveSystem.cs.meta similarity index 100% rename from RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Move/MoveSystem.cs.meta rename to RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Player/Move/PlayerMoveSystem.cs.meta diff --git a/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Move/MoveSystemAuthoring.cs b/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Player/Move/PlayerMoveSystemAuthoring.cs similarity index 71% rename from RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Move/MoveSystemAuthoring.cs rename to RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Player/Move/PlayerMoveSystemAuthoring.cs index 13d7253b..8e7bcd4d 100644 --- a/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Move/MoveSystemAuthoring.cs +++ b/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Player/Move/PlayerMoveSystemAuthoring.cs @@ -3,16 +3,16 @@ namespace RMC.DOTS.Samples.Templates.DOTSGameTemplate { - public class MoveSystemAuthoring : MonoBehaviour + public class PlayerMoveSystemAuthoring : MonoBehaviour { [SerializeField] public bool IsSystemEnabled = true; public struct MoveSystemIsEnabledTag : IComponentData {} - public class MoveSystemAuthoringBaker : Baker + public class PlayerMoveSystemAuthoringBaker : Baker { - public override void Bake(MoveSystemAuthoring authoring) + public override void Bake(PlayerMoveSystemAuthoring authoring) { if (authoring.IsSystemEnabled) { diff --git a/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Move/MoveSystemAuthoring.cs.meta b/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Player/Move/PlayerMoveSystemAuthoring.cs.meta similarity index 100% rename from RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Move/MoveSystemAuthoring.cs.meta rename to RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Player/Move/PlayerMoveSystemAuthoring.cs.meta diff --git a/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Common.cs b/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/UI/Common.cs similarity index 100% rename from RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Common.cs rename to RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/UI/Common.cs diff --git a/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Common.cs.meta b/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/UI/Common.cs.meta similarity index 100% rename from RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Common.cs.meta rename to RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/UI/Common.cs.meta diff --git a/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Wall.meta b/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Wall.meta new file mode 100644 index 00000000..65782ab6 --- /dev/null +++ b/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Wall.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 077edd9cfa54f4646a929c74a516cf83 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Rotation.meta b/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Wall/Rotation.meta similarity index 100% rename from RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Rotation.meta rename to RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Wall/Rotation.meta diff --git a/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Rotation/RotateComponent.cs b/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Wall/Rotation/RotateComponent.cs similarity index 100% rename from RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Rotation/RotateComponent.cs rename to RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Wall/Rotation/RotateComponent.cs diff --git a/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Rotation/RotateComponent.cs.meta b/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Wall/Rotation/RotateComponent.cs.meta similarity index 100% rename from RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Rotation/RotateComponent.cs.meta rename to RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Wall/Rotation/RotateComponent.cs.meta diff --git a/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Rotation/RotateComponentAuthoring.cs b/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Wall/Rotation/RotateComponentAuthoring.cs similarity index 100% rename from RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Rotation/RotateComponentAuthoring.cs rename to RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Wall/Rotation/RotateComponentAuthoring.cs diff --git a/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Rotation/RotateComponentAuthoring.cs.meta b/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Wall/Rotation/RotateComponentAuthoring.cs.meta similarity index 100% rename from RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Rotation/RotateComponentAuthoring.cs.meta rename to RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Wall/Rotation/RotateComponentAuthoring.cs.meta diff --git a/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Rotation/RotateSystem.cs b/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Wall/Rotation/RotateSystem.cs similarity index 100% rename from RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Rotation/RotateSystem.cs rename to RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Wall/Rotation/RotateSystem.cs diff --git a/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Rotation/RotateSystem.cs.meta b/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Wall/Rotation/RotateSystem.cs.meta similarity index 100% rename from RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Rotation/RotateSystem.cs.meta rename to RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Wall/Rotation/RotateSystem.cs.meta diff --git a/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Rotation/RotateSystemAuthoring.cs b/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Wall/Rotation/RotateSystemAuthoring.cs similarity index 100% rename from RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Rotation/RotateSystemAuthoring.cs rename to RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Wall/Rotation/RotateSystemAuthoring.cs diff --git a/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Rotation/RotateSystemAuthoring.cs.meta b/RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Wall/Rotation/RotateSystemAuthoring.cs.meta similarity index 100% rename from RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Rotation/RotateSystemAuthoring.cs.meta rename to RMC DOTS/Samples~/RMC DOTS Game Templates/DOTSGameTemplate/Scripts/Runtime/Wall/Rotation/RotateSystemAuthoring.cs.meta diff --git a/RMC DOTS/Samples~/RMC DOTS Library Demos.meta b/RMC DOTS/Samples~/RMC DOTS Library Demos.meta index beaac3d6..1852a545 100644 --- a/RMC DOTS/Samples~/RMC DOTS Library Demos.meta +++ b/RMC DOTS/Samples~/RMC DOTS Library Demos.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 9daa12c21b9dc87478e6fa50acc82ca4 +guid: 3d34569ca7faf4b438397c8ee9829b5e folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/RMC DOTS/Samples~/RMC DOTS Library Demos/Demos/Input/Scripts/Runtime/Input.cs b/RMC DOTS/Samples~/RMC DOTS Library Demos/Demos/Input/Scripts/Runtime/Input.cs index ab97e01b..b4c5f4de 100644 --- a/RMC DOTS/Samples~/RMC DOTS Library Demos/Demos/Input/Scripts/Runtime/Input.cs +++ b/RMC DOTS/Samples~/RMC DOTS Library Demos/Demos/Input/Scripts/Runtime/Input.cs @@ -8,6 +8,7 @@ public class Input : MonoBehaviour protected void Start() { Debug.Log("Input Demo. Use arrow keys to move."); + } } } \ No newline at end of file diff --git a/RMC DOTS/Samples~/RMC DOTS Library Demos/Demos/Input/Scripts/Runtime/PlayerMove/PlayerMoveSystem.cs b/RMC DOTS/Samples~/RMC DOTS Library Demos/Demos/Input/Scripts/Runtime/PlayerMove/PlayerMoveSystem.cs index e5bb2535..3e1c5a1a 100644 --- a/RMC DOTS/Samples~/RMC DOTS Library Demos/Demos/Input/Scripts/Runtime/PlayerMove/PlayerMoveSystem.cs +++ b/RMC DOTS/Samples~/RMC DOTS Library Demos/Demos/Input/Scripts/Runtime/PlayerMove/PlayerMoveSystem.cs @@ -24,17 +24,40 @@ public void OnCreate(ref SystemState state) [BurstCompile] public void OnUpdate(ref SystemState state) { - // First get the current input value from the InputComponent component. - // This component is set in the InputSystem that runs every frame. + // First get the current input value from the PlayerMoveInput component. This component is set in the + // GetPlayerInputSystem that runs earlier in the frame. float2 move = SystemAPI.GetSingleton().Move; + float2 look = SystemAPI.GetSingleton().Look; float deltaTime = SystemAPI.Time.DeltaTime; + float multiplier = 10f; + float2 moveComposite = float2.zero; + // Here we support EITHER look or move to move around + // Prioritize MOVE, if no MOVE is set, then use look + if (move.x != 0) + { + moveComposite.x = move.x; + } + else + { + moveComposite.x = look.x; + } + + if (move.y != 0) + { + moveComposite.y = move.y; + } + else + { + moveComposite.y = look.y; + } + // Loop through all players. Move each foreach (var localTransform in SystemAPI.Query>().WithAll()) { - localTransform.ValueRW.Position.x += move.x * deltaTime * 10; - localTransform.ValueRW.Position.z += move.y * deltaTime * 10; + localTransform.ValueRW.Position.x += moveComposite.x * (deltaTime * multiplier); + localTransform.ValueRW.Position.z += moveComposite.y * (deltaTime * multiplier); } } } diff --git a/RMC DOTS/Samples~/RMC DOTS Library Demos/Demos/PhysicsTrigger/Scripts/Runtime/PhysicsTrigger.cs b/RMC DOTS/Samples~/RMC DOTS Library Demos/Demos/PhysicsTrigger/Scripts/Runtime/PhysicsTrigger.cs index 295334a0..5bb0ab23 100644 --- a/RMC DOTS/Samples~/RMC DOTS Library Demos/Demos/PhysicsTrigger/Scripts/Runtime/PhysicsTrigger.cs +++ b/RMC DOTS/Samples~/RMC DOTS Library Demos/Demos/PhysicsTrigger/Scripts/Runtime/PhysicsTrigger.cs @@ -8,6 +8,25 @@ public class PhysicsTrigger : MonoBehaviour protected void Start() { Debug.Log("PhysicsTrigger Demo. Watch the console."); + + //Make sure the project has layers set properly + var playerName = "Player"; + var playerIndexCurrent = LayerMask.NameToLayer(playerName); + var playerIndexRequired = 6; + + if (playerIndexCurrent != playerIndexRequired) + { + Debug.Log($"LayerMask failed. Must set Layer {playerIndexRequired} to be '{playerName}'."); + } + + var goalName = "Goal"; + var goalIndexCurrent = LayerMask.NameToLayer(goalName); + var goalIndexRequired = 9; + + if (goalIndexCurrent != goalIndexRequired) + { + Debug.Log($"LayerMask failed. Must set Layer {goalIndexRequired} to be '{goalName}'."); + } } } } \ No newline at end of file diff --git a/RMC DOTS/Scripts/Runtime/Systems/Input/InputComponent.cs b/RMC DOTS/Scripts/Runtime/Systems/Input/InputComponent.cs index 91f3220a..3643f39b 100644 --- a/RMC DOTS/Scripts/Runtime/Systems/Input/InputComponent.cs +++ b/RMC DOTS/Scripts/Runtime/Systems/Input/InputComponent.cs @@ -4,9 +4,17 @@ namespace RMC.DOTS.Systems.Input { + /// + /// Basic reusable input. + /// If you need to add more input, it's probably best + /// to COMPLETELY COPY/PASTE and create a NEW input pipeline and system + /// public struct InputComponent : IComponentData { public float2 Move; + public float2 Look; + public bool Action1; + public bool Action2; } } #endif //ENABLE_INPUT_SYSTEM \ No newline at end of file diff --git a/RMC DOTS/Scripts/Runtime/Systems/Input/InputSystem.cs b/RMC DOTS/Scripts/Runtime/Systems/Input/InputSystem.cs index 1ddeee64..82c33cfa 100644 --- a/RMC DOTS/Scripts/Runtime/Systems/Input/InputSystem.cs +++ b/RMC DOTS/Scripts/Runtime/Systems/Input/InputSystem.cs @@ -21,8 +21,14 @@ protected override void OnCreate() protected override void OnUpdate() { - Vector2 playerMoveInput = _rmcDotsInputAction.Standard.Move.ReadValue(); - SystemAPI.SetSingleton(new InputComponent { Move = playerMoveInput }); + SystemAPI.SetSingleton( + new InputComponent + { + Move = _rmcDotsInputAction.Standard.Move.ReadValue(), + Look = _rmcDotsInputAction.Standard.Look.ReadValue(), + Action1 = _rmcDotsInputAction.Standard.Action1.IsPressed(), + Action2 = _rmcDotsInputAction.Standard.Action2.IsPressed() + }); } } } diff --git a/RMC DOTS/Settings/Input/RMCDotsInputAction.cs b/RMC DOTS/Settings/Input/RMCDotsInputAction.cs index 39542d25..d4f3d538 100644 --- a/RMC DOTS/Settings/Input/RMCDotsInputAction.cs +++ b/RMC DOTS/Settings/Input/RMCDotsInputAction.cs @@ -2,7 +2,7 @@ // // This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator // version 1.7.0 -// from Assets/Shared_Convert_To_RMCDOTS_Package/Settings/Input/RMCDotsInputAction.inputactions +// from Packages/com.rmc.rmc-dots/RMC DOTS/Settings/Input/RMCDotsInputAction.inputactions // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -123,119 +123,108 @@ public @RMCDotsInputAction() ""isPartOfComposite"": true }, { - ""name"": ""ArrowKeys"", - ""id"": ""d099d6ac-2deb-486b-ab1b-a9309968ed67"", - ""path"": ""2DVector"", - ""interactions"": """", - ""processors"": """", - ""groups"": """", - ""action"": ""Move"", - ""isComposite"": true, - ""isPartOfComposite"": false - }, - { - ""name"": ""up"", - ""id"": ""d17389ed-5c7a-40df-ab2f-bd08bd936c7c"", - ""path"": ""/upArrow"", + ""name"": """", + ""id"": ""dc113864-c3e5-42d0-827a-d4e40c32cad2"", + ""path"": ""/enter"", ""interactions"": """", ""processors"": """", ""groups"": """", - ""action"": ""Move"", + ""action"": ""Action1"", ""isComposite"": false, - ""isPartOfComposite"": true + ""isPartOfComposite"": false }, { - ""name"": ""down"", - ""id"": ""0bcc228f-3358-4684-9228-da316858f8fb"", - ""path"": ""/downArrow"", + ""name"": """", + ""id"": ""60d20594-9ca9-4cd7-9eda-869f290d2748"", + ""path"": ""/space"", ""interactions"": """", ""processors"": """", ""groups"": """", - ""action"": ""Move"", + ""action"": ""Action2"", ""isComposite"": false, - ""isPartOfComposite"": true + ""isPartOfComposite"": false }, { - ""name"": ""left"", - ""id"": ""bf29cb97-5120-4829-b32b-1413e2714528"", - ""path"": ""/leftArrow"", + ""name"": """", + ""id"": ""bf171f4e-b72d-4789-bbf0-47d3e3d5d03e"", + ""path"": ""/buttonSouth"", ""interactions"": """", ""processors"": """", ""groups"": """", - ""action"": ""Move"", + ""action"": ""Action2"", ""isComposite"": false, - ""isPartOfComposite"": true + ""isPartOfComposite"": false }, { - ""name"": ""right"", - ""id"": ""d50a3a57-c654-4bdb-957b-cba6c2642435"", - ""path"": ""/rightArrow"", + ""name"": """", + ""id"": ""a9018316-02b1-4f38-aa9d-c663738ddfc9"", + ""path"": ""/leftStick"", ""interactions"": """", ""processors"": """", ""groups"": """", ""action"": ""Move"", ""isComposite"": false, - ""isPartOfComposite"": true + ""isPartOfComposite"": false }, { - ""name"": """", - ""id"": ""dc113864-c3e5-42d0-827a-d4e40c32cad2"", - ""path"": ""/enter"", + ""name"": ""ArrowKeys"", + ""id"": ""d099d6ac-2deb-486b-ab1b-a9309968ed67"", + ""path"": ""2DVector"", ""interactions"": """", ""processors"": """", ""groups"": """", - ""action"": ""Action1"", - ""isComposite"": false, + ""action"": ""Look"", + ""isComposite"": true, ""isPartOfComposite"": false }, { - ""name"": """", - ""id"": ""60d20594-9ca9-4cd7-9eda-869f290d2748"", - ""path"": ""/space"", + ""name"": ""up"", + ""id"": ""d17389ed-5c7a-40df-ab2f-bd08bd936c7c"", + ""path"": ""/upArrow"", ""interactions"": """", ""processors"": """", ""groups"": """", - ""action"": ""Action2"", + ""action"": ""Look"", ""isComposite"": false, - ""isPartOfComposite"": false + ""isPartOfComposite"": true }, { - ""name"": """", - ""id"": ""bf171f4e-b72d-4789-bbf0-47d3e3d5d03e"", - ""path"": ""/buttonSouth"", + ""name"": ""down"", + ""id"": ""0bcc228f-3358-4684-9228-da316858f8fb"", + ""path"": ""/downArrow"", ""interactions"": """", ""processors"": """", ""groups"": """", - ""action"": ""Action2"", + ""action"": ""Look"", ""isComposite"": false, - ""isPartOfComposite"": false + ""isPartOfComposite"": true }, { - ""name"": """", - ""id"": ""a9018316-02b1-4f38-aa9d-c663738ddfc9"", - ""path"": ""/leftStick"", + ""name"": ""left"", + ""id"": ""bf29cb97-5120-4829-b32b-1413e2714528"", + ""path"": ""/leftArrow"", ""interactions"": """", ""processors"": """", ""groups"": """", - ""action"": ""Move"", + ""action"": ""Look"", ""isComposite"": false, - ""isPartOfComposite"": false + ""isPartOfComposite"": true }, { - ""name"": """", - ""id"": ""56ad8ff9-2088-4f22-9abf-17f36f656d76"", - ""path"": ""/rightStick"", + ""name"": ""right"", + ""id"": ""d50a3a57-c654-4bdb-957b-cba6c2642435"", + ""path"": ""/rightArrow"", ""interactions"": """", ""processors"": """", ""groups"": """", ""action"": ""Look"", ""isComposite"": false, - ""isPartOfComposite"": false + ""isPartOfComposite"": true }, { ""name"": """", - ""id"": ""fe946663-e01c-4ef2-9f79-815ea6bfc9ae"", - ""path"": ""/delta"", + ""id"": ""56ad8ff9-2088-4f22-9abf-17f36f656d76"", + ""path"": ""/rightStick"", ""interactions"": """", ""processors"": """", ""groups"": """", diff --git a/RMC DOTS/Settings/Input/RMCDotsInputAction.inputactions b/RMC DOTS/Settings/Input/RMCDotsInputAction.inputactions index 8bfcd78c..f4a0186b 100644 --- a/RMC DOTS/Settings/Input/RMCDotsInputAction.inputactions +++ b/RMC DOTS/Settings/Input/RMCDotsInputAction.inputactions @@ -99,119 +99,108 @@ "isPartOfComposite": true }, { - "name": "ArrowKeys", - "id": "d099d6ac-2deb-486b-ab1b-a9309968ed67", - "path": "2DVector", - "interactions": "", - "processors": "", - "groups": "", - "action": "Move", - "isComposite": true, - "isPartOfComposite": false - }, - { - "name": "up", - "id": "d17389ed-5c7a-40df-ab2f-bd08bd936c7c", - "path": "/upArrow", + "name": "", + "id": "dc113864-c3e5-42d0-827a-d4e40c32cad2", + "path": "/enter", "interactions": "", "processors": "", "groups": "", - "action": "Move", + "action": "Action1", "isComposite": false, - "isPartOfComposite": true + "isPartOfComposite": false }, { - "name": "down", - "id": "0bcc228f-3358-4684-9228-da316858f8fb", - "path": "/downArrow", + "name": "", + "id": "60d20594-9ca9-4cd7-9eda-869f290d2748", + "path": "/space", "interactions": "", "processors": "", "groups": "", - "action": "Move", + "action": "Action2", "isComposite": false, - "isPartOfComposite": true + "isPartOfComposite": false }, { - "name": "left", - "id": "bf29cb97-5120-4829-b32b-1413e2714528", - "path": "/leftArrow", + "name": "", + "id": "bf171f4e-b72d-4789-bbf0-47d3e3d5d03e", + "path": "/buttonSouth", "interactions": "", "processors": "", "groups": "", - "action": "Move", + "action": "Action2", "isComposite": false, - "isPartOfComposite": true + "isPartOfComposite": false }, { - "name": "right", - "id": "d50a3a57-c654-4bdb-957b-cba6c2642435", - "path": "/rightArrow", + "name": "", + "id": "a9018316-02b1-4f38-aa9d-c663738ddfc9", + "path": "/leftStick", "interactions": "", "processors": "", "groups": "", "action": "Move", "isComposite": false, - "isPartOfComposite": true + "isPartOfComposite": false }, { - "name": "", - "id": "dc113864-c3e5-42d0-827a-d4e40c32cad2", - "path": "/enter", + "name": "ArrowKeys", + "id": "d099d6ac-2deb-486b-ab1b-a9309968ed67", + "path": "2DVector", "interactions": "", "processors": "", "groups": "", - "action": "Action1", - "isComposite": false, + "action": "Look", + "isComposite": true, "isPartOfComposite": false }, { - "name": "", - "id": "60d20594-9ca9-4cd7-9eda-869f290d2748", - "path": "/space", + "name": "up", + "id": "d17389ed-5c7a-40df-ab2f-bd08bd936c7c", + "path": "/upArrow", "interactions": "", "processors": "", "groups": "", - "action": "Action2", + "action": "Look", "isComposite": false, - "isPartOfComposite": false + "isPartOfComposite": true }, { - "name": "", - "id": "bf171f4e-b72d-4789-bbf0-47d3e3d5d03e", - "path": "/buttonSouth", + "name": "down", + "id": "0bcc228f-3358-4684-9228-da316858f8fb", + "path": "/downArrow", "interactions": "", "processors": "", "groups": "", - "action": "Action2", + "action": "Look", "isComposite": false, - "isPartOfComposite": false + "isPartOfComposite": true }, { - "name": "", - "id": "a9018316-02b1-4f38-aa9d-c663738ddfc9", - "path": "/leftStick", + "name": "left", + "id": "bf29cb97-5120-4829-b32b-1413e2714528", + "path": "/leftArrow", "interactions": "", "processors": "", "groups": "", - "action": "Move", + "action": "Look", "isComposite": false, - "isPartOfComposite": false + "isPartOfComposite": true }, { - "name": "", - "id": "56ad8ff9-2088-4f22-9abf-17f36f656d76", - "path": "/rightStick", + "name": "right", + "id": "d50a3a57-c654-4bdb-957b-cba6c2642435", + "path": "/rightArrow", "interactions": "", "processors": "", "groups": "", "action": "Look", "isComposite": false, - "isPartOfComposite": false + "isPartOfComposite": true }, { "name": "", - "id": "fe946663-e01c-4ef2-9f79-815ea6bfc9ae", - "path": "/delta", + "id": "56ad8ff9-2088-4f22-9abf-17f36f656d76", + "path": "/rightStick", "interactions": "", "processors": "", "groups": "", diff --git a/package.json b/package.json index c37d20f1..c5d58cf4 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "com.rmc.rmc-dots", "displayName": "RMC DOTS", - "version": "0.8.1", + "version": "0.8.2", "unity": "2022.3", "description": "DOTS library for Unity Development by Rivello Multimedia Consulting", "keywords": [