Add AI and Patrol components, update related resources and presenters

This commit is contained in:
2025-10-30 21:53:31 +01:00
parent 90d3abd83f
commit 5ea02e7bf9
18 changed files with 361 additions and 22 deletions

View File

@@ -1,7 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using CryptonymThunder.Code.Extensions;
using CryptonymThunder.Code.Resources;
using GameCore.AI;
using GameCore.Attributes;
using GameCore.Combat;
using GameCore.Combat.Interfaces;
@@ -46,6 +48,8 @@ public class ComponentFactory
Register<WorldIdComponentResource>(res => new WorldIdComponent(res.WorldId));
Register<ButtonComponentResource>(CreateButtonComponent);
Register<LogicSequenceComponentResource>(CreateLogicSequenceComponent);
Register<AIComponentResource>(CreateAIComponent);
Register<PatrolComponentResource>(CreatePatrolComponent);
}
public IComponent Create(Resource resource)
@@ -187,4 +191,25 @@ public class ComponentFactory
return component;
}
private AIComponent CreateAIComponent(AIComponentResource resource)
{
return new AIComponent
{
CurrentState = resource.InitialState,
SightRange = resource.SightRange,
FieldOfView = resource.FieldOfView,
AttackRange = resource.AttackRange,
ChaseGiveUpTime = resource.ChaseGiveUpTime,
ReactionTime = resource.ReactionTime,
};
}
private PatrolComponent CreatePatrolComponent(PatrolComponentResource resource)
{
return new PatrolComponent
{
IsLooping = resource.IsLooping,
};
}
}