Exemplo n.º 1
0
    /// <summary>
    /// Metoda tworząca cały pokój
    /// </summary>
    /// <param name="level">Nr poziomu</param>
    /// <param name="cell">Komórka labiryntu która reprezentuje tworzony pokój</param>
    /// <returns></returns>
    public GameObject SetupRoom(int level, Cell cell)
    {
        _roomCell = cell;

        RoomSetup();
        InitialiseList();
        PlaceDoors();

        if (cell.Type == CellType.Common)
        {
            _monstersManager.SpawnEnemies(level, _roomHolder.gameObject);
            _obstaclesManager.SpawnObstacles(_roomHolder.gameObject);
            _roomHolder.gameObject.GetComponentsInChildren <Door>().ToList().ForEach(door => door.Close());
        }
        else if (cell.Type == CellType.Boss)
        {
            _monstersManager.SpawnBoss(level, _roomHolder.gameObject);
            _roomHolder.gameObject.GetComponentsInChildren <Door>().ToList().ForEach(door => door.Close());
        }
        else
        {
            _roomHolder.gameObject.GetComponentsInChildren <Door>().ToList().ForEach(door => door.Open());
        }

        if (cell.Type == CellType.Shop)
        {
            SetupShop(level);
        }
        if (cell.Type == CellType.Premium)
        {
            SetupPremium(level);
        }

        return(_roomHolder.gameObject);
    }