Files
cryptonhym-thunder/Code/Presenters/PatrolComponentPresenter.cs

38 lines
994 B
C#

using CryptonymThunder.Code.Extensions;
using GameCore.AI;
using GameCore.ECS;
using GameCore.ECS.Interfaces;
using Godot;
using Godot.Collections;
namespace CryptonymThunder.Code.Presenters;
[GlobalClass]
public partial class PatrolComponentPresenter : Node, IPresenterComponent
{
[Export] public Array<Marker3D> PatrolPoints { get; set; }= [];
public void Initialize(Entity coreEntity, World world)
{
var patrolComponent = world.GetComponent<PatrolComponent>(coreEntity);
if (patrolComponent == null)
{
world.Logger.Warn($"Entity '{coreEntity.Id}' does not have a PatrolComponent.");
return;
}
patrolComponent.PatrolPoints.Clear();
foreach (var marker in PatrolPoints)
{
patrolComponent.PatrolPoints.Add(marker.GlobalPosition.ToGameCore());
}
}
public void SyncToPresentation(float delta)
{
}
public void SyncToCore(float delta)
{
}
}