bool checkRoomSide(RoomData nextRoom, RoomIndex doorIndex, DoorDirection direction, Dictionary <RoomIndex, Door> doorDictionary, ref List <DoorHelperClass> doorsToClose) { Door doorAtIndex; bool hasCorrespondingDoor = true; if (doorDictionary.TryGetValue(doorIndex, out doorAtIndex)) { bool found = false; foreach (Door door in nextRoom.doors) { if (door.Direction == direction && door.WorldIndex == doorIndex) { doorsToClose.Add(new DoorHelperClass(doorAtIndex, doorIndex)); found = true; } } if (!found) { hasCorrespondingDoor = false; } } return(hasCorrespondingDoor); }
Dictionary <RoomIndex, Door> getDoorDictionary(DoorDirection direction) { switch (direction) { case DoorDirection.NORTH: return(northDoors); case DoorDirection.EAST: return(eastDoors); case DoorDirection.SOUTH: return(southDoors); case DoorDirection.WEST: return(westDoors); case DoorDirection.UP: return(upDoors); case DoorDirection.DOWN: return(downDoors); default: return(new Dictionary <RoomIndex, Door>()); } }
public DoorHto(DoorDirection direction) { Direction = direction; CloseDoor = new CloseDoorAction(direction == DoorDirection.None); OpenDoor = new OpenDoorAction(direction == DoorDirection.None); }
public void HideDoorPlaceholder(DoorDirection dir) { switch (dir) { case DoorDirection.Left: if (LeftDoor) { LeftDoor.gameObject.SetActive(false); } break; case DoorDirection.Right: if (RightDoor) { RightDoor.gameObject.SetActive(false); } break; case DoorDirection.Down: if (DownDoor) { DownDoor.gameObject.SetActive(false); } break; case DoorDirection.Up: if (UpDoor) { UpDoor.gameObject.SetActive(false); } break; } }
/* * public void SetLinkPositionUp() * { * // 112 * Global.Var.SCALE, 64 * Global.Var.SCALE * Game.link.X = 120 * Global.Var.SCALE; * Game.link.Y = (64 + 35) * Global.Var.SCALE; * } * * public void SetLinkPositionDown() * { * Game.link.X = 120 * Global.Var.SCALE; * Game.link.Y = 193 * Global.Var.SCALE; * } * public void SetLinkPositionLeft() * { * Game.link.X = 35 * Global.Var.SCALE; * Game.link.Y = (136 + 8) * Global.Var.SCALE; * } * public void SetLinkPositionRight() * { * Game.link.X = (224 - 16) * Global.Var.SCALE; * Game.link.Y = (136+8) * Global.Var.SCALE; * } */ public void SetLinkPosition(DoorDirection door = DoorDirection.UP) { if (CurrentRoom.Id == 13) { Game.link.X = FORTY_EIGHT * Global.Var.SCALE; Game.link.Y = NINETY_SEVEN * Global.Var.SCALE; return; } switch (door) { case DoorDirection.UP: Game.link.X = 120 * Global.Var.SCALE; Game.link.Y = 193 * Global.Var.SCALE; break; case DoorDirection.DOWN: Game.link.X = 120 * Global.Var.SCALE; Game.link.Y = (64 + 35) * Global.Var.SCALE; break; case DoorDirection.LEFT: Game.link.X = (224 - 16) * Global.Var.SCALE; Game.link.Y = (136 + 8) * Global.Var.SCALE; break; case DoorDirection.RIGHT: Game.link.X = 35 * Global.Var.SCALE; Game.link.Y = (136 + 8) * Global.Var.SCALE; break; } }
public Door(DoorDirection dir, int length, int x, int y) { this.doorDir = dir; this.doorLength = length; this.x = x; this.y = y; }
public OpenDoorLeftState(Entities.Doors.Door currentDoor) { CurrentDoor = currentDoor; Sprite = BlockSpriteFactory.Instance.CreateOpenDoorLeft(); IsOpen = true; doorDirection = DoorDirection.LEFT; }
public Result <Unit> EmergencyStop() { _currentDirection = DoorDirection.Down; _currentSpeed = 0; return(Unit.Instance); }
public void CreateRoom(Transform door_transform, DoorDirection door_direction) { switch (door_direction) { case DoorDirection.bottom: //bottom spawn_position = new Vector2(door_transform.position.x - (Mathf.Floor(columns / 2)), door_transform.position.y - rows); break; case DoorDirection.left: //left spawn_position = new Vector2(door_transform.position.x - columns, door_transform.position.y - (Mathf.Floor(rows / 2))); break; case DoorDirection.right: //right spawn_position = new Vector2(door_transform.position.x + 1, door_transform.position.y - (Mathf.Floor(rows / 2))); break; } Rooms.Add(Instantiate(RoomParent, spawn_position, Quaternion.identity)); GameController.instance.Rooms.text = "Rooms: " + Rooms.Count; //only change if using varying room sizes Rooms[Rooms.Count - 1].GetComponent <RoomCreator>().rows = rows; Rooms[Rooms.Count - 1].GetComponent <RoomCreator>().columns = columns; Rooms[Rooms.Count - 1].GetComponent <RoomCreator>().room_type = RoomType.general; Rooms[Rooms.Count - 1].GetComponent <RoomCreator>().GenerateRoom(door_direction); }
public static DoorDirection opposite(this DoorDirection direction) { switch (direction) { case DoorDirection.NORTH: return(DoorDirection.SOUTH); case DoorDirection.EAST: return(DoorDirection.WEST); case DoorDirection.SOUTH: return(DoorDirection.NORTH); case DoorDirection.WEST: return(DoorDirection.EAST); case DoorDirection.UP: return(DoorDirection.DOWN); case DoorDirection.DOWN: return(DoorDirection.UP); default: return(DoorDirection.NORTH); } }
private void Run() { _tokenSource = new CancellationTokenSource(); CancellationToken ct = _tokenSource.Token; var task = Task.Run(() => { _isRunning = true; while (_isRunning) { if (ct.IsCancellationRequested) { _currentDirection = DoorDirection.None; _isRunning = false; } else if (_currentDirection != DoorDirection.None) { if (_driveCounter <= 0) { Console.WriteLine($"Finished driving."); _driveCounter = 0; _currentDirection = DoorDirection.None; } else { _driveCounter -= _currentSpeed; } } Thread.Sleep(100); } }, _tokenSource.Token); }
public WallRightState(Entities.Doors.Door currentDoor) { CurrentDoor = currentDoor; Sprite = BlockSpriteFactory.Instance.CreateWallRight(); IsOpen = false; doorDirection = DoorDirection.RIGHT; }
public HoleDoorTopState(Entities.Doors.Door currentDoor) { CurrentDoor = currentDoor; Sprite = BlockSpriteFactory.Instance.CreateHoleDoorTop(); IsOpen = true; doorDirection = DoorDirection.UP; }
public LockedDoorBottomState(Entities.Doors.Door currentDoor) { CurrentDoor = currentDoor; Sprite = BlockSpriteFactory.Instance.CreateLockedDoorBottom(); IsOpen = false; doorDirection = DoorDirection.DOWN; }
public ClosedDoorTopState(Entities.Doors.Door currentDoor) { CurrentDoor = currentDoor; Sprite = BlockSpriteFactory.Instance.CreateClosedDoorTop(); IsOpen = false; doorDirection = DoorDirection.UP; }
public Door(DoorDirection dir, int length, int x, int y, Room owner) { this.doorDir = dir; this.doorLength = length; this.x = x; this.y = y; this.owner = owner; }
public IronDoorBlock(DoorDirection direction, bool upperHalf) { UpperHalf = upperHalf; if (!UpperHalf) { Direction = direction; } }
private void ChangeCellDoor(CellData cellData, DoorDirection _direction) { var cellBlock = _selectedRowVM.CellsCollection.First(x => x.CellData.IndexNum == cellData.IndexNum); cellData.DoorDirection = cellBlock.UpdateDoorDirection(_direction); //StageSave(); }
public static DoorDirection rotate90Horizontal(this DoorDirection direction, int rotations = 1) { if (direction == DoorDirection.UP || direction == DoorDirection.DOWN) { return(direction); } return((DoorDirection)(((int)direction + rotations) % 4)); }
public static Vector3 DoorDirectionToVector3(DoorDirection direction) { if (direction == DoorDirection.East) return Vector3.East; if (direction == DoorDirection.North) return Vector3.North; if (direction == DoorDirection.West) return Vector3.West; return Vector3.East; }
public void SetConnection(DoorDirection direction, WorldData.RoomCell cell, WorldData.RoomCell thisCell) { if (cell.Type == RoomType.Empty || cell.Reference == null) { return; } Connections[direction] = cell; cell.Reference.Connections[InverseDirection[direction]] = thisCell; }
public static DoorDirection next(this DoorDirection direction) { if (direction == DoorDirection.UP || direction == DoorDirection.DOWN) { return(direction.opposite()); } else { return((DoorDirection)(((int)direction + 1) % 4)); } }
public VMRowBlock() { _cellsCollection = new ObservableCollection <CellBlock>(); _rowData = new RowData(); _facade = Facade.Down; _direction = Direction.LeftToRight; _doorDirection = DoorDirection.Left; _isHitTestVisible = true; CellsCollection.CollectionChanged += CellsCollection_CollectionChanged; }
public WorldData.RoomCell GetConnectedRoomCell(DoorDirection direction) { WorldData.RoomCell result = new WorldData.RoomCell(); if (Connections.ContainsKey(direction)) { result = Connections[direction]; } return(result); }
//public DoorData[] DoorsData() { //var data = doorsData; //for (int i = 0; i < doorsData.Length; i++) //data[i].doorTransform = doorsData[i].doorTransform; //return data; //} public (bool, DoorData) FindDoorsWithDir(DoorDirection dir) { foreach (var doorEntry in doorsData) { if (doorEntry.direction == dir) { return(true, doorEntry); } } return(false, default);
public void LoadNewRoom(GameObject room, DoorDirection direction) { if (isLoading) { return; } isLoading = true; Debug.Log("Loading " + room.name); StartCoroutine(LoadRoom(room, direction)); }
IEnumerator LoadRoom(GameObject room, DoorDirection direction) { Fader.instance.FadeOut(); yield return(new WaitForSeconds(0.3f)); //AsyncOperation unload = SceneManager.UnloadSceneAsync(currentRoom); GameObject[] effects = GameObject.FindGameObjectsWithTag("Effects"); for (int i = 0; i < effects.Length; i++) { Destroy(effects[i]); } if (currentRoom != null) { currentRoom.SetActive(false); } foreach (GameObject r in rooms) { if (r.name == room.name) { r.SetActive(true); currentRoom = r; } } shop.SetActive(false); if (direction == DoorDirection.RIGHT) { playerRB.position = playerPosLeft; } if (direction == DoorDirection.LEFT) { playerRB.position = playerPosRight; } if (direction == DoorDirection.UP) { playerRB.position = playerPosDown; } if (direction == DoorDirection.DOWN) { playerRB.position = playerPosUp; } Fader.instance.FadeIn(); yield return(new WaitForSeconds(.3f)); isLoading = false; }
public bool HasEdge(WorldData data, DoorDirection direction) { var offset = RoomOffset[direction]; var pos = MapPosition + offset; if (pos.x < 0 || pos.x >= data.WorldWidth || pos.y < 0 || pos.y >= data.WorldHeight) { return(true); } return(false); }
/* * CreateDoor(DoorDirection, Window) Creates a door in a north, south, east or west direction * * @doorDir : DoorDirection enum selection of the direction e.g: DoorDirection.North * @window : Window Window sizing for door positions */ void CreateDoor(DoorDirection doorDir, Window window) { Circle door = new Circle(); Circle doorCollisions = new Circle(); door.Radius = 75; doorCollisions.Radius = 150; doorLoc = new Point2D(); doorCollisionLoc = new Point2D(); switch (doorDir) { case DoorDirection.North: _DoorBitmaps.Add(new Bitmap("northDoor", "doorN.png")); _OpenDoorBitmaps.Add(new Bitmap("northDoorOpen", "doorOpenN.png")); doorLoc.X = window.Width / 2 - _DoorBitmaps[_DoorBitmaps.Count - 1].Width / 2; doorLoc.Y = 0; doorCollisionLoc.X = window.Width / 2; doorCollisionLoc.Y = -25; break; case DoorDirection.East: _DoorBitmaps.Add(new Bitmap("eastDoor", "doorE.png")); _OpenDoorBitmaps.Add(new Bitmap("eastDoorOpen", "doorOpenE.png")); doorLoc.X = window.Width - _DoorBitmaps[_DoorBitmaps.Count - 1].Width; doorLoc.Y = window.Height / 2 - _DoorBitmaps[_DoorBitmaps.Count - 1].Height / 2; doorCollisionLoc.X = window.Width; doorCollisionLoc.Y = window.Height / 2; break; case DoorDirection.South: _DoorBitmaps.Add(new Bitmap("southDoor", "doorS.png")); _OpenDoorBitmaps.Add(new Bitmap("southDoorOpen", "doorOpenS.png")); doorLoc.X = window.Width / 2 - _DoorBitmaps[_DoorBitmaps.Count - 1].Width / 2; doorLoc.Y = window.Height - _DoorBitmaps[_DoorBitmaps.Count - 1].Height; doorCollisionLoc.X = window.Width / 2; doorCollisionLoc.Y = window.Height + 25; break; case DoorDirection.West: _DoorBitmaps.Add(new Bitmap("westDoor", "doorW.png")); _OpenDoorBitmaps.Add(new Bitmap("westDoorOpen", "doorOpenW.png")); doorLoc.X = 0; doorLoc.Y = window.Height / 2 - _DoorBitmaps[_DoorBitmaps.Count - 1].Height / 2; doorCollisionLoc.X = 0; doorCollisionLoc.Y = window.Height / 2; break; } door.Center = doorLoc; doorCollisions.Center = doorCollisionLoc; _Doors.Add(door); _DoorCollisions.Add(doorCollisions); }
public static DoorDirection GetOpposite(this DoorDirection portalDirection) { switch (portalDirection) { default: case DoorDirection.North: return(DoorDirection.South); case DoorDirection.East: return(DoorDirection.West); case DoorDirection.South: return(DoorDirection.North); case DoorDirection.West: return(DoorDirection.East); } }
public static IntVector2 GetIntVector2(this DoorDirection portalDirection) { switch (portalDirection) { default: case DoorDirection.North: return(IntVector2.up); case DoorDirection.East: return(IntVector2.right); case DoorDirection.South: return(IntVector2.down); case DoorDirection.West: return(IntVector2.left); } }
public WoodenDoorBlock(DoorDirection direction, bool upperHalf) { UpperHalf = upperHalf; if (!UpperHalf) Direction = direction; }
public RoomNode(int width, int height, DoorDirection direction) : base(width, height) { this.Initialize(direction); }
private void Initialize(DoorDirection direction) { this.direction = direction; }