-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
+ changed workflow to more separation bewteen data and logic #10 + added lookDirectionInput system to turn player towards mouse position on screen
- Loading branch information
Ammon
committed
May 26, 2020
1 parent
1a5ab92
commit 1445919
Showing
13 changed files
with
160 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,4 +20,4 @@ public struct InputHoldComponent : IComponentData | |
// authoring the data in the Editor. | ||
|
||
public float3 Value; | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...ent/Components/InputHoldComponent.cs.meta → ...nt/Components/InputHoldComponents.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
10 changes: 10 additions & 0 deletions
10
Assets/Scripts/PhysicsBasedMovement/Components/LookDirectionInputComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using System; | ||
using Unity.Entities; | ||
using Unity.Mathematics; | ||
|
||
[Serializable] | ||
[GenerateAuthoringComponent] | ||
public struct LookDirectionInputComponent : IComponentData | ||
{ | ||
public float2 Value; | ||
} |
11 changes: 11 additions & 0 deletions
11
Assets/Scripts/PhysicsBasedMovement/Components/LookDirectionInputComponent.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
11 changes: 11 additions & 0 deletions
11
Assets/Scripts/PhysicsBasedMovement/Components/MovementDirectionInputComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using System; | ||
using Unity.Entities; | ||
using Unity.Mathematics; | ||
|
||
[Serializable] | ||
[GenerateAuthoringComponent] | ||
public struct MovementDirectionInputComponent : IComponentData | ||
{ | ||
public float2 NewValue; | ||
public float2 OldValue; | ||
} |
11 changes: 11 additions & 0 deletions
11
Assets/Scripts/PhysicsBasedMovement/Components/MovementDirectionInputComponent.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
Assets/Scripts/PhysicsBasedMovement/System/PlayerInputTurnSystem.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using Unity.Collections; | ||
using Unity.Entities; | ||
using Unity.Jobs; | ||
using Unity.Mathematics; | ||
using Unity.Transforms; | ||
using Unity.Physics; | ||
using Unity.Physics.Extensions; | ||
|
||
public class PlayerInputTurnSystem : SystemBase | ||
{ | ||
protected override void OnUpdate() | ||
{ | ||
Entities.WithName("TurnPlayerTowardsInput") | ||
.WithAll<PlayerPhysicsTag>() | ||
.WithNone<Prefab>() | ||
.ForEach( | ||
(ref PhysicsVelocity Veclocity, in PhysicsMass Mass) => | ||
{ | ||
//ComponentExtensions.ApplyAngularImpulse(ref Veclocity, Mass, float3.zero); | ||
} | ||
).Schedule(); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Assets/Scripts/PhysicsBasedMovement/System/PlayerInputTurnSystem.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.