forked from Unity-Technologies/EntityComponentSystemSamples
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathConfigAuthoring.cs
More file actions
executable file
·33 lines (30 loc) · 948 Bytes
/
ConfigAuthoring.cs
File metadata and controls
executable file
·33 lines (30 loc) · 948 Bytes
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
using Unity.Entities;
using UnityEngine;
namespace Tutorials.Tanks.Step6
{
public class ConfigAuthoring : MonoBehaviour
{
public GameObject TankPrefab;
public int TankCount;
public float SafeZoneRadius;
class Baker : Baker<ConfigAuthoring>
{
public override void Bake(ConfigAuthoring authoring)
{
var entity = GetEntity(TransformUsageFlags.None);
AddComponent(entity, new Config
{
TankPrefab = GetEntity(authoring.TankPrefab, TransformUsageFlags.Dynamic),
TankCount = authoring.TankCount,
SafeZoneRadius = authoring.SafeZoneRadius
});
}
}
}
public struct Config : IComponentData
{
public Entity TankPrefab;
public int TankCount;
public float SafeZoneRadius; // Used in a later step.
}
}