public WorldGeneratorToCorridorsManager(LogicGrid masterLogicGrid, Tilemap floor, TileBase tileFloor, int wallThickness)
 {
     this.masterLogicGrid = masterLogicGrid;
     this.floor           = floor;
     this.tileFloor       = tileFloor;
     this.wallThickness   = wallThickness;
 }
Exemplo n.º 2
0
 public DeadEndManager(dataStruct.WorldGeneratorToDeadEndManager data)
 {
     m_masterLogicGrid = data.masterLogicGrid;
     m_floor           = data.floor;
     m_door            = data.door;
     m_ends            = data.ends;
 }
 public WorldGeneratorToDeadEndManager(LogicGrid masterLogicGrid, Tilemap floor, Tilemap door, List <Vector2Int> ends)
 {
     this.masterLogicGrid = masterLogicGrid;
     this.floor           = floor;
     this.door            = door;
     this.ends            = ends;
 }
        private void SetPathNodesFromLogicGrid(LogicGrid logicGrid)
        {
            m_cellToNodes = new Dictionary <common.world.cellType.LogicCell, PathNode>();
            m_logicGrid   = logicGrid;
            m_pathNodes   = new PathNode[m_logicGrid.Width, m_logicGrid.Height];
            List <PathNode> pathNodeList = new List <PathNode>();

            for (int x = 0; x < m_logicGrid.Width; x++)
            {
                for (int y = 0; y < m_logicGrid.Height; y++)
                {
                    if (m_logicGrid.Grid[x, y] != null)
                    {
                        m_pathNodes[x, y] = new PathNode(x, y);
                        m_cellToNodes[m_logicGrid.Grid[x, y]] = m_pathNodes[x, y];
                        m_logicGrid.Grid[x, y].OnChange      += UpdateNeighboursOnCellChange;
                        pathNodeList.Add(m_pathNodes[x, y]);
                    }
                }
            }

            //Add neighbours to each walkable pathnode
            foreach (PathNode p in m_pathNodes)
            {
                if (p != null)
                {
                    AddAllWalkableNeighbours(p);
                }
            }

            m_pathfinding = new Pathfinding(pathNodeList);
            m_setUpDone   = true;
        }
Exemplo n.º 5
0
 public CorridorsManager(dataStruct.WorldGeneratorToCorridorsManager data)
 {
     m_masterLogicGrid = data.masterLogicGrid;
     m_floor           = data.floor;
     m_tileFloor       = data.tileFloor;
     m_wallThickness   = data.wallThickness;
 }
Exemplo n.º 6
0
        public LogicGrid AddOneRoom()
        {
            m_masterLogicGrid = new ubv.common.world.LogicGrid(m_boundariesMap.x, m_boundariesMap.y);
            RoomInfo myRoom = GameObject.Instantiate(m_randomRoomPoolSection0[0], new Vector3(6, 6, 0), Quaternion.identity, m_grid.transform);

            AddToMasterGrid(myRoom, new Vector2Int(6, 6));
            return(m_masterLogicGrid);
        }
Exemplo n.º 7
0
 public void TestSetOneTrue()
 {
     _grid = new LogicGrid <Fish, Currency>();
     _grid[Fish.Haddock, Currency.EUR] = true;
     Assert.True(_grid[Fish.Haddock, Currency.EUR]);
     Assert.False(_grid[Fish.Haddock, Currency.KRW]);
     Assert.False(_grid[Fish.Cod, Currency.EUR]);
 }
Exemplo n.º 8
0
 public DoorManager(dataStruct.WorldGeneratorToDoorManager worldGeneratorToDoorManager)
 {
     m_masterLogicGrid = worldGeneratorToDoorManager.masterLogicGrid;
     m_floor           = worldGeneratorToDoorManager.floor;
     m_door            = worldGeneratorToDoorManager.door;
     m_tileFloor       = worldGeneratorToDoorManager.tileFloor;
     m_tileDoor        = worldGeneratorToDoorManager.tileDoor;
     m_roomInMap       = worldGeneratorToDoorManager.roomInMap;
 }
        private void OnWorldGenerated()
        {
            LogicGrid logicGrid = m_worldGenerator.GetMasterLogicGrid();

            if (logicGrid != null)
            {
                this.SetPathNodesFromLogicGrid(logicGrid);
            }
        }
 public WorldGeneratorToDoorManager(LogicGrid masterLogicGrid, Tilemap floor, Tilemap door, TileBase tileFloor, TileBase tileDoor, List <RoomInfo> roomInMap)
 {
     this.masterLogicGrid = masterLogicGrid;
     this.floor           = floor;
     this.door            = door;
     this.tileFloor       = tileFloor;
     this.tileDoor        = tileDoor;
     this.roomInMap       = roomInMap;
 }
Exemplo n.º 11
0
 public void TestSetFourFalse()
 {
     _grid = new LogicGrid <Fish, Currency>();
     foreach (Fish fish in new List <Fish> {
         Fish.Cod, Fish.Flake, Fish.Plaice, Fish.Rock
     })
     {
         _grid[fish, Currency.EUR] = false;
     }
     Assert.True(_grid[Fish.Haddock, Currency.EUR]);
 }
Exemplo n.º 12
0
 public WallManager(dataStruct.WolrdGeneratorToWallManager data)
 {
     m_masterLogicGrid = data.masterLogicGrid;
     m_wall            = data.wall;
     m_tileWall        = data.tilewall;
 }
Exemplo n.º 13
0
        public LogicGrid GenerateRoomGrid()
        {
            m_masterLogicGrid = new ubv.common.world.LogicGrid(m_boundariesMap.x, m_boundariesMap.y);

            Vector3 positionUnusedRoom = new Vector3(-250, -250, 0);

            foreach (RoomInfo room in m_mandatoryRoomPoolSection0)
            {
                RoomInfo myRoom = GameObject.Instantiate(room, positionUnusedRoom, Quaternion.identity, m_grid.transform);
                AddRoomToSection0(myRoom, true);
            }
            for (int i = 0; i < m_numberRandomRoomSection0; i++)
            {
                RoomInfo myRoom = GameObject.Instantiate(
                    m_randomRoomPoolSection0[Random.Range(0, m_randomRoomPoolSection0.Count)],
                    positionUnusedRoom,
                    Quaternion.identity,
                    m_grid.transform
                    );
                AddRoomToSection0(myRoom, false);
            }
            for (int i = 0; i < m_numberRandomRoomBottomLeft; i++)
            {
                RoomInfo myRoom = GameObject.Instantiate(
                    m_randomRoomPoolSection0[Random.Range(0, m_randomRoomPoolSection0.Count)],
                    positionUnusedRoom,
                    Quaternion.identity,
                    m_grid.transform
                    );
                AddRoomToBottomLeft(myRoom, false);
            }
            for (int i = 0; i < m_numberRandomRoomTopLeft; i++)
            {
                RoomInfo myRoom = GameObject.Instantiate(
                    m_randomRoomPoolSection0[Random.Range(0, m_randomRoomPoolSection0.Count)],
                    positionUnusedRoom,
                    Quaternion.identity,
                    m_grid.transform
                    );
                AddRoomToTopLeft(myRoom, false);
            }
            for (int i = 0; i < m_numberRandomRoomTopRight; i++)
            {
                RoomInfo myRoom = GameObject.Instantiate(
                    m_randomRoomPoolSection0[Random.Range(0, m_randomRoomPoolSection0.Count)],
                    positionUnusedRoom,
                    Quaternion.identity,
                    m_grid.transform
                    );
                AddRoomToTopRight(myRoom, false);
            }
            for (int i = 0; i < m_numberRandomRoomBottomRight; i++)
            {
                RoomInfo myRoom = GameObject.Instantiate(
                    m_randomRoomPoolSection0[Random.Range(0, m_randomRoomPoolSection0.Count)],
                    positionUnusedRoom,
                    Quaternion.identity,
                    m_grid.transform
                    );
                AddRoomToBottomRight(myRoom, false);
            }

            return(m_masterLogicGrid);
        }
Exemplo n.º 14
0
 public void TestSetOneFalse()
 {
     _grid = new LogicGrid <Fish, Currency>();
     _grid[Fish.Haddock, Currency.EUR] = false;
     Assert.False(_grid[Fish.Haddock, Currency.EUR]);
 }
 public WolrdGeneratorToWallManager(LogicGrid masterLogicGrid, Tilemap wall, TileBase tilewall)
 {
     this.masterLogicGrid = masterLogicGrid;
     this.wall            = wall;
     this.tilewall        = tilewall;
 }