Beispiel #1
0
    void HandleActionInput()
    {
        //test code

        /*if(!iskilltest)
         * {
         *      if(Input.GetKey(KeyCode.K))
         *      {
         *              playerInfo.testKill(roomMenu.localPlayer.ID,3001,3);
         *              iskilltest = true;
         *      }
         * }*/

        /*if(Input.GetKey(KeyCode.F1))
         *      playerAnimator.Behit();
         * if(Input.GetKey(KeyCode.F2))
         *      playerAnimator.KnockDown();
         * if(Input.GetKey(KeyCode.F4))
         *      playerAnimator.Freeze();
         * if(Input.GetKey(KeyCode.F5))
         *      playerAnimator.Dizzy();*/
        /*if(Input.GetKey(KeyCode.F6))
         *      playerAnimator.Die();*/
        //---------------------------

        /*if(Input.GetKey(KeyCode.F2))
         *      playerAnimator.KnockDown();*/
        if (!playerInfo.IsGodPowering)
        {
            if (Input.GetKey(KeyCode.LeftShift))
            {
                if (playerInfo.GodPower >= 100)
                {
                    GodPowerInput();
                }
                else
                {
                    Debug.Log("No Enough GodPower");
                }
            }
        }

        /*if(Input.GetKey(KeyCode.R))
         * {
         *      BuffSkillInput(1);
         * }
         * else if(Input.GetKey(KeyCode.F))
         *      BuffSkillInput(2);*/
        if (Input.GetKey(KeyCode.Q))
        {
            if (roomMenu.localPlayer.properties.HealthWaterNum > 0)
            {
                WaterInput(0);
            }
        }
        else if (Input.GetKey(KeyCode.E))
        {
            if (roomMenu.localPlayer.properties.ManaWaterNum > 0)
            {
                WaterInput(1);
            }
        }

        if (playerAnimator.LockAnimating == false)
        {
            if (playerAnimator.lockRolling == false)
            {
                if (playerAnimator.Mode == TP_Animator.CharacterMode.None)
                {
                    if (Input.GetButton("Roll") && (playerAnimator.MoveDirection == TP_Animator.Direction.Left || playerAnimator.MoveDirection == TP_Animator.Direction.Right || playerAnimator.MoveDirection == TP_Animator.Direction.LeftForward || playerAnimator.MoveDirection == TP_Animator.Direction.RightForward))
                    {
                        //Jump();
                        Roll();
                    }
                }
            }
            if (Input.GetKey(KeyCode.Alpha1))
            {
                PreSkillInput(1);
            }
            if (Input.GetKey(KeyCode.Alpha2))
            {
                PreSkillInput(2);
            }
            if (Input.GetKey(KeyCode.Alpha3))
            {
                PreSkillInput(3);
            }
            if (Input.GetKey(KeyCode.Alpha4))
            {
                PreSkillInput(4);
            }
            if (Input.GetKey(KeyCode.Alpha5))
            {
                if (roomMenu.localPlayer.properties.ThrowingWeaponNum > 0)
                {
                    PreSkillInput(5);
                }
            }

            if (playerAnimator.Mode == TP_Animator.CharacterMode.Skilling)
            {
                if (Input.GetMouseButton(0))
                {
                    SkillInput();
                }
                else if (Input.GetMouseButton(1))
                {
                    playerAnimator.CurrentSkillRange.SetActive(false);
                    playerAnimator.Mode = TP_Animator.CharacterMode.None;
                }
            }

            if (playerAnimator.State == TP_Animator.CharacterState.KnockingDown)
            {
                if (Input.anyKey)
                {
                    StandUpInput();
                }
            }

            if (Input.GetKey(KeyCode.C))
            {
                if (playerInfo.GetVital((int)VitalName.Energy).CurValue == playerInfo.MaxEnergy)
                {
                    PreSkillInput(5);
                    //playerAnimator.LockAnimating = true;
                }
                else
                {
                    Debug.Log("Not Enough Energy");
                }
            }
        }

        if (playerAnimator.LockAttacking == false)
        {
            if (playerAnimator.State == TP_Animator.CharacterState.Idle)
            {
                if (playerAnimator.LockAnimating == false)
                {
                    /*if(Input.GetMouseButton(2))
                     * {
                     *      EnergyStoreInput(0);
                     * }*/
                    if (playerAnimator.Mode == TP_Animator.CharacterMode.None)
                    {
                        if (Input.GetMouseButton(0))
                        {
                            if (playerInfo.Type == TP_Info.CharacterType.Melee)
                            {
                                MeleeAttackInput(0);
                            }
                            else
                            {
                                MagicAttackInput(0);
                            }
                        }
                        else if (Input.GetMouseButtonDown(1))
                        {
                            if (playerInfo.Type == TP_Info.CharacterType.Melee)
                            {
                                MeleeAttackInput(1);
                            }
                            else
                            {
                                MagicAttackInput(1);
                            }
                        }
                    }
                }
            }
            else if (playerAnimator.State == TP_Animator.CharacterState.Running)
            {
                /*if(Input.GetMouseButton(2))
                 * {
                 *      EnergyStoreInput(0);
                 * }*/
                /*if(Input.GetKey(KeyCode.Alpha1))
                 *      PreSkillInput(1);
                 * if(Input.GetKey(KeyCode.Alpha2))
                 *      PreSkillInput(2);
                 * if(Input.GetKey(KeyCode.Alpha3))
                 *      PreSkillInput(3);
                 * if(Input.GetKey(KeyCode.Alpha4))
                 *      PreSkillInput(4);
                 * if(Input.GetKey(KeyCode.Alpha5))
                 * {
                 *      if(roomMenu.localPlayer.properties.ThrowingWeaponNum>0)
                 *              PreSkillInput(5);
                 * }*/
                if (playerAnimator.Mode == TP_Animator.CharacterMode.None)
                {
                    if (playerAnimator.LockAnimating == false)
                    {
                        if (Input.GetMouseButton(0))
                        {
                            if (playerInfo.Type == TP_Info.CharacterType.Melee)
                            {
                                MeleeAttackInput(0);
                            }
                            else
                            {
                                MagicAttackInput(0);
                            }
                        }
                        else if (Input.GetMouseButtonDown(1))
                        {
                            if (playerInfo.Type == TP_Info.CharacterType.Magic)
                            {
                                MagicAttackInput(1);
                            }
                        }
                    }
                }

                /*else if(playerAnimator.Mode==TP_Animator.CharacterMode.Skilling)
                 * {
                 *      if(Input.GetMouseButton(0))
                 *              SkillInput();
                 *      else if(Input.GetMouseButton(1))
                 *      {
                 *              playerAnimator.CurrentSkillRange.SetActive(false);
                 *              playerAnimator.Mode = TP_Animator.CharacterMode.None;
                 *      }
                 * }*/
            }
            else if (playerAnimator.State == TP_Animator.CharacterState.MagicStoring)
            {
                if (Input.GetMouseButton(1))
                {
                    //if(TP_Info.Instance.AttackWay==TP_Info.CharacterAttack.MagicAttack)
                    MagicAttackInput(1);
                }
                else if (Input.GetMouseButtonUp(1))
                {
                    MagicAttackInput(2);
                }
            }
            else if (playerAnimator.CanAttack())
            {
                if (playerAnimator.Mode == TP_Animator.CharacterMode.None)
                {
                    if (playerInfo.Type == TP_Info.CharacterType.Melee)
                    {
                        if (Input.GetMouseButton(0))
                        {
                            MeleeAttackInput(0);
                        }
                        else if (Input.GetMouseButton(1))
                        {
                            MeleeAttackInput(1);
                        }
                    }
                }
            }
        }
    }