示例#1
0
 public void LoseLife(bool ignoreInvulnerable)
 {
     if (loseLifeDelay <= 0)
     {
         if (!countdownScript.ContainsCountdown("Invulnerable") || ignoreInvulnerable)
         {
             countdownScript.AddCountdown("Invulnerable", 2f);
             lives--;
             Spawn();
             GetComponent <Player_SyncLives>().TransmitLives(lives);
         }
         loseLifeDelay = 1f;
         if (lives <= 0)
         {
             transform.position = new Vector3(1000, 1000, 1000);
         }
     }
 }
    // Use this for initialization
    void Start()
    {
        spriteRenderer = GetComponent <SpriteRenderer>();

        GameObject[] ships = GameObject.FindGameObjectsWithTag("Player");
        foreach (GameObject ship in ships)
        {
            if (ship.GetComponent <Ship>().GetShipID() == bulletID)
            {
                bulletColor = ship.GetComponent <Ship>().shipColor;
            }
        }
        spriteRenderer.color = bulletColor;

        countdownScript = GetComponent <Countdown>();
        countdownScript.AddCountdown("lifeSpan", 2f);

        isOwnBullet = GetLocalShip().GetComponent <Ship>().GetShipID() == bulletID;
    }