Exemplo n.º 1
0
 public void gameOver()
 {
     sounds.Play("Lose");
     Debug.Log("GAME OVER");
     pause(true);
     gameIsOver = true;
 }
Exemplo n.º 2
0
 public void fire(bool isPlayer, Vector2 target)
 {
     if (ammo && ammoCount > 0 && lastFired >= fireRate)
     {
         sounds.Play("Fire");
         lastFired = 0.0f;
         if (isPlayer)
         {
             if (!melee)
             {
                 ammoCount -= 1;
                 gameManager.instance.alertEnemies(this);
             }
             if (ammoCount == 0)
             {
                 GetComponent <SpriteRenderer> ().color = Color.red;
             }
             ammo.gameObject.layer = LayerMask.NameToLayer("Player Ammo");
         }
         else
         {
             ammo.gameObject.layer = LayerMask.NameToLayer("Enemy Ammo");
         }
         Ammo shell = GameObject.Instantiate(ammo, transform.position, transform.rotation) as Ammo;
         shell.setDirection((target - (Vector2)transform.position).normalized);
     }
     else if (ammoCount < 1 && lastFired >= fireRate)
     {
         lastFired = 0.0f;
         gameManager.instance.sounds.Play("Empty");
     }
 }