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 m_AiGroup; private readonly List m_CacheEntities = new List(); public BehaviorManagerTickSys(CombatContext context) { var aiMatcher = (Matcher)Matcher.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); } } } } }