You cannot 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.2 KiB
		
	
	
	
		
			C#
		
	
			
		
		
	
	
			41 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			C#
		
	
| namespace Game
 | |
| {
 | |
|     public partial class AIEntityBase<T> 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;
 | |
|             });
 | |
|         }
 | |
|     }
 | |
| } |