|  |  |  |  | namespace Game | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     public partial class AIEntityBase<T> where T : new() | 
					
						
							|  |  |  |  |     { | 
					
						
							|  |  |  |  |         protected void FindTarget() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             Selector(() => | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 Condition("是否有目标", () => _entity.Target() != 0); | 
					
						
							|  |  |  |  |                 Do("重新寻找目标", () => | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     //TODO 现在直接设置为玩家 | 
					
						
							|  |  |  |  |                     _entity.SetTarget(Util.GetMaster().ID()); | 
					
						
							|  |  |  |  |                     return ETaskStatus.Success; | 
					
						
							|  |  |  |  |                 }); | 
					
						
							|  |  |  |  |             }); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         protected void CheckStagger() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             Condition($"检查硬直状态", () => !Util.EntityIsStagger(_entity)); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         protected void CheckModuleType(EAIModuleType moduleType) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             Condition($"检查模块类型-{moduleType}", () => _entity.aI.ModuleType.Value == moduleType); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         protected void CheckDistance(float min, float max) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             Condition($"距离在{min}到{max}之间", () => | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 var distance = Util.EntityDistance(_entity.ID(), _entity.Target()); | 
					
						
							|  |  |  |  |                 return distance >= min && distance <= max; | 
					
						
							|  |  |  |  |             }); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         protected void SetHungryIncrease(EAIModuleType moduleType, float value,float rate) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             Do($"{moduleType}[{value}](*{rate})", () => | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 if (_entity.aI.ModuleType.Value != moduleType) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     return ETaskStatus.Failure; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 _entity.aI.HungryIncrease = value; | 
					
						
							|  |  |  |  |                 _entity.aI.HungryIncreaseRate = rate; | 
					
						
							|  |  |  |  |                 return ETaskStatus.Success; | 
					
						
							|  |  |  |  |             }); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  | } |