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