Initial import
This commit is contained in:
44
Assets/Scripts/Authoring/PlayerStateAuthoring.cs
Normal file
44
Assets/Scripts/Authoring/PlayerStateAuthoring.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
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<PlayerStateAuthoring>
|
||||
{
|
||||
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<PlayerTechBufferElement>(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user