Ejemplo n.º 1
0
    void Update()
    {
        if (isDead)
        {
            timeToRespawn -= Time.deltaTime;
            if (timeToRespawn <= 0)
            {
                Respawn();
            }
        }
        else
        {
            if (currentFireCooldown < maxFireCooldown)
            {
                currentFireCooldown += Time.deltaTime;
            }

            if (currentLaserCooldown < maxLaserCooldown)
            {
                currentLaserCooldown += Time.deltaTime;
            }

            BoundaryCheckCircle();

            if (!bmManager.canShotgunShoot)
            {
                ShootBullet();
            }
            else
            {
                FireShotgun();
            }

            if (bmManager.canSpartanLaser)
            {
                FireSpartanLaser();
            }

            //Use the ship motor from a past assignment.
            Vector2 input = new Vector2(Input.GetAxisRaw("Horizontal_P" + playerNumber), Input.GetAxisRaw("Vertical_P" + playerNumber));

            motor.HandleMovementInput(input);

            if (invincible)
            {
                invicibilityLeft -= Time.deltaTime;
                if (invicibilityLeft <= 0)
                {
                    invincible = false;
                }
            }
        }
    }