/
ComponentTypes.cs
69 lines (57 loc) · 1.58 KB
/
ComponentTypes.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
using Unity.Entities;
using Unity.Mathematics;
using Unity.Transforms;
namespace TwoStickPureExample
{
public struct PlayerInput : IComponentData
{
public float3 Move;
public float3 Shoot;
public float FireCooldown;
public bool Fire => FireCooldown <= 0.0 && math.length(Shoot) > 0.5f;
}
public struct Shot : IComponentData
{
public float TimeToLive;
public float Energy;
}
public struct Factions
{
public const int kPlayer = 0;
public const int kEnemy = 1;
}
public struct ShotSpawnData : IComponentData
{
public Shot Shot;
public Position Position;
public Rotation Rotation;
public int Faction;
}
public struct Health : IComponentData
{
public float Value;
}
// Pure marker types
public struct Enemy : IComponentData { }
public struct EnemyShot : IComponentData { }
public struct PlayerShot : IComponentData { }
public struct EnemyShootState : IComponentData
{
public float Cooldown;
}
// TODO: Call out that this is better than storing state in the system, because it can support things like replay.
public struct EnemySpawnCooldown : IComponentData
{
public float Value;
}
public struct EnemySpawnSystemState : IComponentData
{
public int SpawnedEnemyCount;
public UnityEngine.Random.State RandomState;
}
public struct MoveSpeed : IComponentData
{
public float speed;
}
public struct MoveForward : IComponentData { }
}