Add AI and Patrol components, update related resources and presenters
This commit is contained in:
@@ -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,
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user