Ejemplo n.º 1
0
    void Initialize()
    {
        ship = GetComponent <ShipBehaviour>();

        direction.y = Random.Range(-direction.y, direction.y);

        ship.setAxis(direction);
        ship.SetFly(true);
    }
Ejemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.P))
        {
            if (gameManager.gamePaused)
            {
                gameManager.Resume();
            }
            else
            {
                gameManager.Pause();
            }
        }

        if (gameManager.gamePaused)
        {
            return;
        }

        Vector2 inputAxis = Vector2.zero;

        inputAxis.x = Input.GetAxis("Horizontal");
        inputAxis.y = Input.GetAxis("Vertical");

        // METODO PUBLICO DEL ARCHIVO PLAYERBEHAVIOUR PARA ACTUALIZAR EL AXIS
        player.setAxis(inputAxis);

        // INPUT DISPARO
        if (Input.GetButton("Jump"))
        {
            weapons.ShotWeapon();
        }

        if (powerUp)
        {
            powerUpCounter += Time.deltaTime;
            if (powerUpCounter >= cooldownPowerUp)
            {
                weapons.ResetWeapon();
                powerUpCounter = 0;
                powerUp        = false;
            }
        }
    }