private void SkillActionStartHandler(NpcInfo npc, CharacterInfo target)
        {
            NpcAiStateInfo         info = npc.GetAiStateInfo();
            AiData_Npc_ActionDrive data = GetAiData(npc);

            if (null != data && null != target)
            {
                AiActionInfo aiActionInfo = data.ActiveAction;
                if (null != aiActionInfo)
                {
                    AiSkillActionInfo aiSkillActionInfo = aiActionInfo as AiSkillActionInfo;
                    if (null != aiSkillActionInfo)
                    {
                        aiSkillActionInfo.CurSkillIndex = 0;
                        aiSkillActionInfo.CurSkillCombo = aiSkillActionInfo.GetSkillCombo();
                        //aiSkillActionInfo.LastStartTime = TimeUtility.GetServerMilliseconds();
                        aiSkillActionInfo.StartTime = TimeUtility.GetServerMilliseconds();
                    }
                }
            }
        }
        private AiActionInfo CreateAiAction(int id)
        {
            AiActionInfo   result = null;
            AiActionConfig config = AiActionConfigProvider.Instance.GetDataById(id);

            if (null != config)
            {
                if (config.AiActionType == (int)AiActionType.SKILL)
                {
                    result = new AiSkillActionInfo(config);
                }
                else
                {
                    result = new AiActionInfo(config);
                }
            }
            else
            {
                LogSystem.Warn("CreateAiAction:: can't find AiActionConfig {0}", id);
            }
            return(result);
        }
        private void HandleSkillAction(NpcInfo npc, CharacterInfo target, long deltaTime)
        {
            NpcAiStateInfo         info = npc.GetAiStateInfo();
            AiData_Npc_ActionDrive data = GetAiData(npc);

            if (null != data && null != target)
            {
                Vector3      targetPos    = target.GetMovementStateInfo().GetPosition3D();
                AiActionInfo aiActionInfo = data.ActiveAction;
                if (null != aiActionInfo && !npc.GetSkillStateInfo().IsSkillActivated())
                {
                    AiSkillActionInfo skillActionInfo = aiActionInfo as AiSkillActionInfo;
                    if (null != skillActionInfo && skillActionInfo.CurSkillIndex < skillActionInfo.CurSkillCombo.Count)
                    {
                        int skillId = skillActionInfo.CurSkillCombo[skillActionInfo.CurSkillIndex];
                        if (AiLogicUtility.CanCastSkill(npc, skillId, target))
                        {
                            npc.GetMovementStateInfo().IsMoving = false;
                            NotifyNpcMove(npc);
                            if (TryCastSkill(npc, skillId, target))
                            {
                                skillActionInfo.CurSkillIndex++;
                            }
                        }
                        else
                        {
                            info.Time += deltaTime;
                            if (info.Time > m_IntervalTime)
                            {
                                info.Time = 0;
                                if (AiLogicUtility.IsTooCloseToCastSkill(npc, target))
                                {
                                    Vector3 escapePos = Vector3.Zero;
                                    if (AiLogicUtility.GetEscapeTargetPos(npc, target, 3.0f, ref escapePos))
                                    {
                                        NotifyNpcRun(npc);
                                        AiLogicUtility.PathToTargetWithoutObstacle(npc, data.FoundPath, escapePos, m_IntervalTime, true, this);
                                    }
                                }
                                else
                                {
                                    NotifyNpcRun(npc);
                                    AiLogicUtility.PathToTargetWithoutObstacle(npc, data.FoundPath, targetPos, m_IntervalTime, true, this);
                                }
                            }
                        }
                    }
                    else
                    {
                        skillActionInfo.CurSkillIndex = 0;
                        data.ActiveAction             = null;
                        aiActionInfo.LastStartTime    = TimeUtility.GetServerMilliseconds();
                    }
                }
                if ((!IsAiActionSatifyWithOutProbability(npc, target, aiActionInfo) && aiActionInfo.Config.CanInterrupt) || (aiActionInfo.IsTimeOut(TimeUtility.GetServerMilliseconds()) && !npc.GetSkillStateInfo().IsSkillActivated()))
                {
                    data.ActiveAction          = null;
                    aiActionInfo.LastStartTime = TimeUtility.GetServerMilliseconds();
                    NotifyNpcStopSkill(npc);
                }
            }
        }