Beispiel #1
0
        //使用技能
        protected virtual CommandReplyType CheckUseSkill(UseSkillCommand cmd)
        {
            if (CacheTransform == null)
            {
                return(CommandReplyType.NO);
            }
            if (CannotControlSelf())
            {
                ShowWarning("100012");
                return(CommandReplyType.NO);
            }
            if (CurFsmStateType == ActorFsmStateType.FSM_SKILL)
            {
                return(CommandReplyType.NO);
            }
            if (GetActorState(ActorStateType.IsRide))
            {
                ShowWarning("100011");
                return(CommandReplyType.NO);
            }

            SkillTree skill = m_ActorSkill.GetSkill(cmd.SkillPos);

            if (skill == null)
            {
                return(CommandReplyType.NO);
            }
            if (skill.IsInCD())
            {
                return(CommandReplyType.NO);
            }
            switch (skill.CostType)
            {
            case SkillCostType.Hp:
            {
                bool success = UseHp(skill.CostNum);
                if (!success)
                {
                    return(CommandReplyType.NO);
                }
            }
            break;

            case SkillCostType.Mp:
            {
                bool success = UseMp(skill.CostNum);
                if (!success)
                {
                    return(CommandReplyType.NO);
                }
            }
            break;
            }
            cmd.LastTime = skill.StateTime;

            ChangeState <ActorSkillFsm>(cmd);
            return(CommandReplyType.YES);
        }
Beispiel #2
0
        private void RefreshSkillItems()
        {
            if (GameEntry.Level.PlayerActor == null)
            {
                return;
            }

            IActorSkill skill = GameEntry.Level.PlayerActor.ActorSkill;

            if (skill == null)
            {
                return;
            }

            for (int i = 0; i < m_SkillItems.Length; i++)
            {
                m_SkillItems[i].ShowSkill(skill.GetSkill((SkillPosType)i));
            }
        }