Exemplo n.º 1
0
 // Update is called once per frame
 void Update()
 {
     if (!gameOver)
     {
         if (health <= 0)
         {
             makeGameOver();
             SpawnScript spawn = GameObject.Find("Spawn").GetComponent("SpawnScript") as SpawnScript;
             spawn.makeGameOver(false);
         }
         move();
         rotate();
         if (Input.GetButtonDown("Fire1"))
         {
             if (barks > 0)
             {
                 shoot();
             }
         }
         updateAmmoSlider();
         updateHealthSlider();
         Vector3 camPosition = new Vector3(Camera.main.transform.position.x, Camera.main.transform.position.y, -10);
         if (transform.position.x > -9.66f && transform.position.x < 9.66f)
         {
             camPosition.x = transform.position.x;
         }
         if (transform.position.y > -5.8f && transform.position.y < 5.8f)
         {
             camPosition.y = transform.position.y;
         }
         Camera.main.transform.position = camPosition;
     }
 }