You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.3 KiB
41 lines
1.3 KiB
1 month ago
|
using System.Collections.Generic;
|
||
|
using BehaviorDesigner.Runtime;
|
||
|
using Entitas;
|
||
|
using GAS.Runtime;
|
||
|
using UnityEngine;
|
||
|
|
||
|
namespace CoreGame.Render.System
|
||
|
{
|
||
|
public class BehaviorManagerTickSys : IExecuteSystem
|
||
|
{
|
||
|
private readonly IGroup<CombatEntity> m_AiGroup;
|
||
|
private readonly List<CombatEntity> m_CacheEntities = new List<CombatEntity>();
|
||
|
|
||
|
public BehaviorManagerTickSys(CombatContext context)
|
||
|
{
|
||
|
var aiMatcher = (Matcher<CombatEntity>)Matcher<CombatEntity>.AllOf(CombatComponentsLookup.AI)
|
||
|
.NoneOf(CombatComponentsLookup.Dead);
|
||
|
m_AiGroup = context.GetGroup(aiMatcher);
|
||
|
}
|
||
|
|
||
|
public void Execute(float deltaTime)
|
||
|
{
|
||
|
m_AiGroup.GetEntities(m_CacheEntities);
|
||
|
for (int i = 0; i < m_CacheEntities.Count; i++)
|
||
|
{
|
||
|
var ent = m_CacheEntities[i];
|
||
|
if (ent.TagCountContainer.HasTag(GTagLib.State_Death))
|
||
|
continue;
|
||
|
|
||
|
if (ent.TagCountContainer.HasTag(GTagLib.State_Stun))
|
||
|
continue;
|
||
|
|
||
|
var ai = ent.aI;
|
||
|
if (ai.bt != null)
|
||
|
{
|
||
|
BehaviorManager.instance.Tick(ai.bt);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|