Add AI and Patrol components, update related resources and presenters
This commit is contained in:
38
Code/Presenters/PatrolComponentPresenter.cs
Normal file
38
Code/Presenters/PatrolComponentPresenter.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
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)
|
||||
{
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user