Пример #1
0
    public override void Reason()
    {
        if (m_PlayerBehaviour.IsCopy)
        {
            return;
        }
        if (IsStateReady)
        {
            if (!IsSkillBeBreaked)
            {
                switch (m_skillDirType)
                {
                case 1:            //方向
                {
                    if (m_fireSelected)
                    {
                        //m_playerBehaviour.ChangeForward(m_touchPoint);
                        OnChangeTransition(Transition.PlayerFireInitiativeSkill);
                    }
                }
                break;

                case 2:           //圆形范围
                {
                    if (m_fireSelected)
                    {
                        if (!m_canFireRangeSkill)
                        {
                            float distance = Vector3.Distance(m_playerBehaviour.ThisTransform.position, m_touchPoint);
                            if (distance <= m_skillData.m_launchRange[0])
                            {
                                //m_playerBehaviour.ChangeForward(m_touchPoint);
                                m_canFireRangeSkill = true;
                                var fireState = m_playerBehaviour.FSMSystem.FindState(global::StateID.PlayerInitiativeSkill) as PlayerInitiativeSkillFireState;
                                fireState.m_touchPoint = m_touchPoint;
                                OnChangeTransition(Transition.PlayerFireInitiativeSkill);
                            }
                        }
                    }
                }
                break;

                case 3:           //扇形范围
                {
                    if (m_fireSelected)
                    {
                        m_playerBehaviour.ChangeForward(m_touchPoint);
                        OnChangeTransition(Transition.PlayerFireInitiativeSkill);
                    }
                }
                break;

                default:
                    break;
                }
            }
            else
            {
                //取消技能选择
                this.m_PlayerBehaviour.LeaveInitiativeSkillSelectedState();
                OnChangeTransition(Transition.PlayerToIdle);
            }
        }
    }