Ejemplo n.º 1
0
        void Update()
        {
            if (!stashSystem.isAlive)
            {
                return;
            }

            horizontalMove = Input.GetAxisRaw("Horizontal") * mover.FetchMoveSpeed() *
                             Time.fixedDeltaTime;

            if (mover.FetchGrounded() && IsThrowing())
            {
                aimDirection = new Vector2(Input.GetAxisRaw("Horizontal"),
                                           Input.GetAxisRaw("Vertical"));

                thrower.Aim(aimDirection);

                if (Input.GetButtonDown("Fire1"))
                {
                    thrower.Throw(aimDirection);
                }
            }
            else
            {
                thrower.CancelAim();

                if (Input.GetButtonDown("Jump"))
                {
                    jump = true;
                }
                mover.Move(horizontalMove, jump);
                jump = false;

                if (Input.GetButtonDown("Fire1"))
                {
                    fighter.Attack();
                }

                if (Input.GetButtonDown("Fire2"))
                {
                    fighter.StartRoll();
                }

                if (Input.GetAxisRaw("Pad Vertical") > .1)
                {
                    if (weaponsSwitched)
                    {
                        return;
                    }
                    weaponHandler.SwitchWeapons();
                    weaponsSwitched = true;
                }
                else
                {
                    weaponsSwitched = false;
                }
            }
        }