コード例 #1
0
ファイル: Player.cs プロジェクト: Duubli/Gunnies
    private void Controls()
    {
        Vector2 velocity = bunnyScript.rb2D.velocity;

        velocity.x = Input.GetAxis("Horizontal") * 20f;

        if (Input.GetButton("Vertical") && bunnyScript.isJumping == false)
        {
            bunnyScript.isJumping = true;
            velocity.y            = 20f;
        }

        if (Input.GetButtonDown("Fire"))
        {
            bunnyScript.GetComponentInChildren <Weapon>().Shoot();
        }

        if (Input.GetButton("Reload"))
        {
            bunnyScript.GetComponentInChildren <Weapon>().Reload();
        }

        bunnyScript.SetVelocity(velocity);
        bunnyScript.GetComponentInChildren <Weapon>().RotateWeapon(mousePosition);

        // Trigger must be released to fire again
        bunnyScript.GetComponentInChildren <Weapon>().canFire |= Input.GetButtonUp("Fire");
    }