using Unity.Entities; using UnityEngine; using EE2Clone.Components; using EE2Clone.Core; namespace EE2Clone.Authoring { public class PlayerStateAuthoring : MonoBehaviour { public int StartingFood = 200; public int StartingWood = 200; public int StartingStone = 100; public int StartingGold = 100; public class Baker : Baker { public override void Bake(PlayerStateAuthoring authoring) { var entity = GetEntity(TransformUsageFlags.None); AddComponent(entity, new PlayerStateComponent { PlayerId = 0, CurrentEpoch = Epoch.StoneAge, PopulationCurrent = 0, PopulationMax = GameConstants.StartingPopulationCap, CivilizationId = 0, IsAlive = true }); AddComponent(entity, new PlayerResourcesComponent { Food = authoring.StartingFood, Wood = authoring.StartingWood, Stone = authoring.StartingStone, Gold = authoring.StartingGold, Tin = 0 }); AddBuffer(entity); } } } }