コード例 #1
0
    //--------------------------------------------------------------------------------
    // 技能1按钮单击事件
    //--------------------------------------------------------------------------------
    private void OnBtnSkill01Click(UnityEngine.GameObject go)
    {
        uint dwID = 0;

        m_map2ID.TryGetValue(go, out dwID);
        if (dwID <= 0)
        {
            return;
        }

        // 如果按钮在CD状态,返回,否则开始CD
        if (go.transform.Find("cd").GetComponent <UISprite>().fillAmount != 0)
        {
            return;
        }

        go.transform.Find("cd").GetComponent <UISprite>().fillAmount = 1;
        if (!IsInActCD() || m_LocalFSM.IsInIdle() || m_LocalFSM.IsInMoveing())
        {
            // 直接播放技能
            m_dwCurSkillID = 0;
            m_LocalFSM.ChangeBeHavior(BehaviorType.EState_Skill, dwID);
            SetActCD(true);
        }
        else
        {
            // 连其他技能, 不过需要知道要连接的技能ID, 一般是自己连自己
            m_dwCurSkillID = dwID;
            SkillDoubleHitsAttack();
        }
    }
コード例 #2
0
ファイル: CtrolPlayerMove.cs プロジェクト: liuxx220/GameApp
    void UpdateNoCombatJoystick(float touchX, float touchY)
    {
        if (m_LocalFSM == null)
        {
            return;
        }

        if (m_LocalFSM.IsInIdle() && (Math.Abs(touchX) + Math.Abs(touchY)) > 0f)
        {
            m_LocalFSM.ChangeBeHavior(BehaviorType.EState_Move, 0);
        }

        if (m_LocalFSM.IsInMoveing() && (Math.Abs(touchX) + Math.Abs(touchY)) < 0.001f)
        {
            m_LocalFSM.ChangeBeHavior(BehaviorType.EState_Idle, 0);
        }


        m_velocity = Vector3.zero;
        if (m_character.isGrounded)
        {
            if (touchX > 0)
            {
                m_velocity = Vector3.forward * m_fmovespeed * 0.02f;
            }

            if (touchX < 0)
            {
                m_velocity = Vector3.forward * -m_fmovespeed * 0.02f;
            }

            if (touchY > 0)
            {
                transform.Rotate(0, 120 * Time.deltaTime, 0);
            }

            if (touchY < 0)
            {
                transform.Rotate(0, -120 * Time.deltaTime, 0);
            }
        }

        m_velocity    = transform.TransformDirection(m_velocity);
        m_velocity.y -= m_Gravity * Time.deltaTime;
        m_character.Move(m_velocity);
    }