Пример #1
0
        public Vector3Int GetPathToNextDoor(RoomEntity from, RoomEntity to, MapTilemaps mapTilemaps, DoorDir dir)
        {
            var nextDoorPos = GetNextDoorPos(from, to, mapTilemaps, dir, out var length);

            PlaceCorridor(nextDoorPos, length, mapTilemaps, dir);

            return(Vector3Int.zero);
        }
Пример #2
0
        private Vector3Int GetNextDoorPos(RoomEntity from, RoomEntity to, MapTilemaps mapTilemaps, DoorDir dir
                                          , out int length)
        {
            length = MIN_LENGTH;
            var fromDoor = SelectDoor(dir, from);
            var moveDir  = dir.GetMoveDir();
            var offset   = moveDir * MIN_LENGTH;
            var pos      = fromDoor + offset;

            var roomPos = fromDoor;

            while (DoCornersHasTile(pos, from.Template.width, from.Template.height, mapTilemaps.TypeTilemap))
            {
                pos += moveDir;
                length++;
            }

            return(pos);
        }
Пример #3
0
 private Vector3Int SelectDoor(DoorDir dir, RoomEntity roomEntity)
 {
     return(roomEntity.DoorsDictionary.GetRandomDoor(dir));
 }