namespace Game { public partial class AIEntityBase where T : new() { protected void CastSkill(int index, bool needPermit) { Sequence(($"释放技能[{index}],{needPermit}"), () => { if (needPermit) _checkAttackPermit(); _stop(); _castSkill(index); if (needPermit) _resetAttackPermit(); }); } private void _castSkill(int index) { Do($"释放技能[{index}]", () => { var target = Util.GetEntity(_entity.Target()); var dir = target.Pos() - _entity.Pos(); Util.CastSkillMonster(_entity, index, dir); return ETaskStatus.Success; }); } private void _checkAttackPermit() { Condition("检查攻击权限", () => _entity.aI.AttackPermit.Value); } private void _resetAttackPermit() { Do("重置攻击权限", () => { _entity.aI.AttackPermit.Value = false; return ETaskStatus.Success; }); } } }