Skip to content

Commit

Permalink
Human Navigation System Moves Forward
Browse files Browse the repository at this point in the history
  • Loading branch information
DeadlyApps committed Apr 16, 2018
1 parent 4c7886a commit 5eec25b
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 12 deletions.
8 changes: 8 additions & 0 deletions Assets/GameCode/ComponentTypes.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions Assets/GameCode/ComponentTypes/Human.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
using Unity.Entities;

public struct Human : IComponentData
{

}
11 changes: 11 additions & 0 deletions Assets/GameCode/ComponentTypes/Human.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions Assets/GameCode/HumanNavigationSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using Unity.Entities;
using Unity.Transforms2D;

class HumanNavigationSystem : ComponentSystem
{
public struct HumanData
{
public int Length;
public ComponentDataArray<Position2D> Position;
public ComponentDataArray<Heading2D> Heading;
public ComponentDataArray<Human> Human;
}

[Inject] private HumanData humanDatum;

protected override void OnUpdate()
{
for (int index = 0; index < humanDatum.Length; ++index)
{
Heading2D heading2D = humanDatum.Heading[index];
heading2D.Value = new Unity.Mathematics.float2(1f, 0f);
humanDatum.Heading[index] = heading2D;
}
}
}
File renamed without changes.
6 changes: 5 additions & 1 deletion Assets/GameCode/ZombieSimulatorBootstrap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ private static void DefineArchetypes(EntityManager entityManager)
{
//Humans - Composition of the humans

HumanArchetype = entityManager.CreateArchetype(typeof(MoveSpeed), typeof(Heading2D), typeof(Position2D), typeof(TransformMatrix));
HumanArchetype = entityManager.CreateArchetype(typeof(Human),
typeof(Heading2D),
typeof(MoveSpeed),
typeof(Position2D),
typeof(TransformMatrix));

}

Expand Down
8 changes: 0 additions & 8 deletions Assets/GameCode/ZombieSpawnSystem.cs

This file was deleted.

6 changes: 3 additions & 3 deletions Assets/Scenes/ECS Zombie Simulator.unity
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,13 @@ Transform:
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 282840810}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1, z: -10}
m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068}
m_LocalPosition: {x: 0, y: 30, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0}
--- !u!1 &657261335
GameObject:
m_ObjectHideFlags: 0
Expand Down

0 comments on commit 5eec25b

Please sign in to comment.