Beispiel #1
0
    /*void Update()
     * {
     *      if(Input.GetKey(KeyCode.F12))
     *      {
     *              playerAnimator.State = TP_Animator.CharacterState.Idle;
     *              playerAnimator.LockAnimating = false;
     *              playerAnimator.LockAttacking = false;
     *      }
     *
     *      //if(photonView.isMine){isLocalPlayer = true;}
     *      if(playerInfo.isAI)
     *      {
     *              playerMotor.UpdateMotor(CalculateMoveSpeed());
     *              return;
     *      }
     *      if(!isLocalPlayer) return;
     *      if(Camera.main == null)
     *              return;
     *      if(playerAnimator.State==TP_Animator.CharacterState.Dead||playerAnimator.State==TP_Animator.CharacterState.Freeze||playerAnimator.State==TP_Animator.CharacterState.Dizzing)
     *              return;
     *
     *
     * }*/

    void FixedUpdate()
    {
        if (playerInfo.isAI)
        {
            playerMotor.UpdateMotor(CalculateMoveSpeed());
            return;
        }
        if (WholeGameManager.SP.InGame)
        {
            if (Game_Manager.SP.MyGameState == GameState.Esc || GameUIManager.SP.PressControlling)
            {
                return;
            }
        }
        if (!isLocalPlayer)
        {
            return;
        }
        if (Camera.main == null)
        {
            return;
        }
        if (playerAnimator.State == TP_Animator.CharacterState.Dead || playerAnimator.State == TP_Animator.CharacterState.Freeze || playerAnimator.State == TP_Animator.CharacterState.Dizzing)
        {
            return;
        }
        //if(playerInfo.isAI) return;
        //if(!isLocalPlayer) return;
//-------------------------
        GetLocomotionInput();
        HandleActionInput();
        //CheckRunning();
        playerMotor.UpdateMotor(CalculateMoveSpeed());



        if (Input.GetKeyUp(KeyCode.Z))
        {
            UselightSourceTimer = 0;
            playerAnimator.UseLightSourceInput(false);
        }
//*******************
        if (Input.GetKey(KeyCode.Z))
        {
            if (UselightSourceTimer < 1)
            {
                UselightSourceTimer += Time.fixedDeltaTime;
            }
            else if (UselightSourceTimer == 1)
            {
                if (playerAnimator.State == TP_Animator.CharacterState.Idle || playerAnimator.State == TP_Animator.CharacterState.EnergyStoring)
                {
                    playerInfo.LightSourceInput();
                }
                else
                {
                    GameUIManager.SP.HudWarningLabel.Add("You Have To Stop Moving To Use LightSource!", Color.yellow, 1f);
                }

                UselightSourceTimer = 0;
            }
            if (UselightSourceTimer > 1)
            {
                UselightSourceTimer = 1;
            }

            if (playerAnimator.State == TP_Animator.CharacterState.Idle || playerAnimator.State == TP_Animator.CharacterState.EnergyStoring)
            {
                playerAnimator.UseLightSourceInput(true);
            }
        }

        if (playerAnimator.State == TP_Animator.CharacterState.EnergyStoring)
        {
            if (Input.GetMouseButton(2))
            {
                EnergyStoreInput(0);
            }
            else if (Input.GetMouseButtonUp(2))
            {
                EnergyStoreInput(1);
            }
        }

        if (playerAnimator.LockAttacking == false)
        {
            //	if(playerAnimator.State==TP_Animator.CharacterState.Idle)
            //	{
            if (playerAnimator.LockAnimating == false)
            {
                if (Input.GetMouseButton(2))
                {
                    EnergyStoreInput(0);
                }
            }
        }
        //}
    }