Пример #1
0
    // This method includes a tiny delay to ensure that the counter for mid-air rocket jumps isn't thrown off
    // AND so that the two forces aren't applied inhumanly fast resulting in a higher jump than is otherwise humanly reflexivly possible.
    public IEnumerator JumpThenRocketJump()
    {
        playerMovement.Jump();         // Comunicate with the Player_Movement script to force the player to jump.
        yield return(new WaitForSeconds(0.1f));

        RocketJump();
    }
Пример #2
0
    // Update is called once per frame
    void Update()
    {
        //Get Input
        moveVertical   = Input_Manager.GetAxis("Move Vertical " + (playerNum + 1));
        moveHorizontal = Input_Manager.GetAxis("Move Horizontal " + (playerNum + 1));
        lookVertical   = Input_Manager.GetAxis("Look Vertical " + (playerNum + 1));
        lookHorizontal = Input_Manager.GetAxis("Look Horizontal " + (playerNum + 1));
        if (Input_Manager.GetAxisRaw("Move Vertical " + (playerNum + 1)) > 0 && previousMoveVertical == 0f)
        {
            if (Time.frameCount - lastTapFrame < 20)
            {
                RollForward();
            }
            else
            {
                lastTapFrame = Time.frameCount;
            }
        }
        previousMoveVertical = Input_Manager.GetAxisRaw("Move Vertical " + (playerNum + 1));
        if (Input.GetButton("Change Weapon " + (playerNum + 1)))
        {
            ChooseAttack(moveHorizontal, moveVertical);
        }
        if (Input.GetButton("Run " + (playerNum + 1)) && CheckGrounded())
        {
            movement.runMultiplier = 1.75f;
        }
        else
        {
            movement.runMultiplier = 1f;
        }

        if (Input.GetKeyDown("k"))
        {
            movement.LockOnEnemy();
        }

        //is input greater than 0

        else if (!rolling)
        {
            if (CheckGrounded() && Vector2.SqrMagnitude(new Vector2(moveHorizontal, moveVertical)) > 0.1f)
            {
                //Moves the player using velocities
                movement.Move(moveHorizontal, moveVertical);
            }
        }
        if (Input.GetButtonDown("Jump " + (playerNum + 1)) && CheckGrounded())
        {
            movement.Jump();
        }
        Attack();
        movement.AnimateMovement();
    }
Пример #3
0
    // Update is called once per frame
    void Update()
    {
        horizontal = Input.GetAxis(horizontalAxis);
        vertical   = Input.GetAxis(verticalAxis);

        mouseX = Input.GetAxis("Mouse X");
        mouseY = -Input.GetAxis("Mouse Y");

        if (Input.GetButtonDown(fireButton))
        {
            OnFire();
        }

        if (Input.GetButtonDown(fire2Button))
        {
            OnFire2();
        }

        if (Input.GetKeyDown(KeyCode.LeftShift))
        {
            OnExplodeMine();
        }

        if (Input.GetButtonDown(specialButton))
        {
            OnSpecial();
        }

        if (Input.GetButtonDown(ultButton))
        {
            OnUlt();
        }

        if (Input.GetButtonDown(jumpButton))
        {
            playerMove.Jump();
        }
    }