IsUnderControl() public method

public IsUnderControl ( ) : bool
return bool
示例#1
0
 public void Execute(EntityInfo entity, long deltaTime)
 {
     if (entity.IsUnderControl())
     {
         return;
     }
     if (entity.GetAIEnable())
     {
         AiStateInfo npcAi = entity.GetAiStateInfo();
         if (!npcAi.IsInited)
         {
             OnStateLogicInit(entity, deltaTime);
             npcAi.IsInited = true;
         }
         int curState = npcAi.CurState;
         if (curState > (int)AiStateId.Invalid && curState < (int)AiStateId.MaxNum)
         {
             AiStateHandler handler;
             if (m_Handlers.TryGetValue(curState, out handler))
             {
                 if (OnStateLogicCheck(entity, deltaTime) && null != handler)
                 {
                     handler(entity, deltaTime);
                 }
             }
             else
             {
                 LogSystem.Error("Illegal ai state: " + curState + " entity:" + entity.GetId());
             }
         }
         else
         {
             ChangeToState(entity, (int)AiStateId.Idle);
         }
     }
 }
 public void Execute(EntityInfo entity, long deltaTime)
 {
     if (entity.IsUnderControl()) {
         return;
     }
     if (entity.GetAIEnable()) {
         AiStateInfo npcAi = entity.GetAiStateInfo();
         if (!npcAi.IsInited) {
             OnStateLogicInit(entity, deltaTime);
             npcAi.IsInited = true;
         }
         int curState = npcAi.CurState;
         if (curState > (int)AiStateId.Invalid && curState < (int)AiStateId.MaxNum) {
             AiStateHandler handler;
             if (m_Handlers.TryGetValue(curState, out handler)) {
                 if (OnStateLogicCheck(entity, deltaTime) && null != handler) {
                     handler(entity, deltaTime);
                 }
             } else {
                 LogSystem.Error("Illegal ai state: " + curState + " entity:" + entity.GetId());
             }
         } else {
             ChangeToState(entity, (int)AiStateId.Idle);
         }
     }
 }