示例#1
0
    /// <summary>
    /// Check if ship is burning but only if caller of the function is this ship's status manager
    /// </summary>
    /// <param name="caller">Caller of the function</param>
    /// <returns>Status of ship being on fire</returns>
    public bool IsBurning(object caller)
    {
        ShipStatsManager manager = caller as ShipStatsManager;

        if (manager != null && manager.GetShip(this) == this)
        {
            return(onFire);
        }
        return(false);
    }
示例#2
0
    /// <summary>
    /// Get powerup ship is holding only if caller of the function is this ship's status manager
    /// </summary>
    /// <param name="caller">Caller of the function</param>
    /// <returns>Powerup ship is holding</returns>
    public PowerUpType GetPowerUp(object caller)
    {
        ShipStatsManager manager = caller as ShipStatsManager;

        if (manager != null && manager.GetShip(this) == this)
        {
            return(powerup);
        }
        return(PowerUpType.None);
    }
示例#3
0
    public void RemoveShip(Ship ship)
    {
        ShipStatsManager manager = shipsStats.FirstOrDefault(shipStat => shipStat.GetShip(this) == ship);

        if (manager != null)
        {
            manager.isDead = true;
        }

        _ships.Remove(ship);
        foreach (Ship aliveShip in _ships)
        {
            aliveShip.CheckDeadShip(ship);
        }

        if (_ships.Count < 2)
        {
            gameOver = true;
        }
    }