forked from Unity-Technologies/EntityComponentSystemSamples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExecuteAuthoring.cs
More file actions
73 lines (57 loc) · 1.72 KB
/
Copy pathExecuteAuthoring.cs
File metadata and controls
73 lines (57 loc) · 1.72 KB
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
70
71
72
73
using Unity.Entities;
using UnityEngine;
namespace Tutorials.Tanks.Execute
{
public class ExecuteAuthoring : MonoBehaviour
{
[Header("Step 2")]
public bool TurretRotation;
[Header("Step 3")]
public bool TankMovement;
[Header("Step 4")]
public bool TurretShooting;
[Header("Step 5")]
public bool CannonBall;
[Header("Step 6")]
public bool TankSpawning;
[Header("Step 7")]
public bool SafeZone;
[Header("Step 8")]
public bool Camera;
class Baker : Baker<ExecuteAuthoring>
{
public override void Bake(ExecuteAuthoring authoring)
{
var entity = GetEntity(TransformUsageFlags.None);
if (authoring.TurretRotation) AddComponent<TurretRotation>(entity);
if (authoring.TankMovement) AddComponent<TankMovement>(entity);
if (authoring.TurretShooting) AddComponent<TurretShooting>(entity);
if (authoring.CannonBall) AddComponent<CannonBall>(entity);
if (authoring.TankSpawning) AddComponent<TankSpawning>(entity);
if (authoring.SafeZone) AddComponent<SafeZone>(entity);
if (authoring.Camera) AddComponent<Camera>(entity);
}
}
}
public struct TurretRotation : IComponentData
{
}
public struct TankMovement : IComponentData
{
}
public struct TurretShooting : IComponentData
{
}
public struct CannonBall : IComponentData
{
}
public struct Camera : IComponentData
{
}
public struct SafeZone : IComponentData
{
}
public struct TankSpawning : IComponentData
{
}
}