예제 #1
0
파일: RoomManager.cs 프로젝트: reqv/Theseus
    /// <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);
    }