29 lines
808 B
C#
29 lines
808 B
C#
using Unity.Entities;
|
|
using UnityEngine;
|
|
using EE2Clone.Components;
|
|
using EE2Clone.Core;
|
|
|
|
namespace EE2Clone.Authoring
|
|
{
|
|
public class ResourceNodeAuthoring : MonoBehaviour
|
|
{
|
|
public ResourceType ResourceType = ResourceType.Food;
|
|
public int StartingAmount = 500;
|
|
|
|
public class Baker : Baker<ResourceNodeAuthoring>
|
|
{
|
|
public override void Bake(ResourceNodeAuthoring authoring)
|
|
{
|
|
var entity = GetEntity(TransformUsageFlags.Dynamic);
|
|
|
|
AddComponent(entity, new ResourceNodeTag());
|
|
AddComponent(entity, new ResourceNode
|
|
{
|
|
Type = authoring.ResourceType,
|
|
RemainingAmount = authoring.StartingAmount
|
|
});
|
|
}
|
|
}
|
|
}
|
|
}
|