/// <summary> /// Declares that this place is not to be used by any other puzzles. /// If we didn't declare this place to be something, reserve random place. /// </summary> public void ReservePlace() { if (this.IsUnlock || this.IsLock || this.IsBossLock) { _section.ReservePlace(PlaceIndex); } else { PlaceIndex = _section.ReservePlace(); _room = _section.Places[PlaceIndex].Room; this.UpdatePosition(); } }
/// <summary> /// This place will precede locked place and contain some means to unlock it. /// </summary> /// <param name="lockPlace"></param> public void DeclareUnlock(PuzzlePlace lockPlace) { var place = lockPlace as PuzzlePlace; if (place == null || place.PlaceIndex == -1) { throw new PuzzleException("We can't declare unlock"); } this.PlaceIndex = _section.GetUnlock(place); _room = _section.Places[PlaceIndex].Room; this.IsUnlock = true; this.UpdatePosition(); }
/// <summary> /// Makes it a locked place with a locked door. /// </summary> public void DeclareLock(bool lockSelf = false) { var doorElement = _section.GetLock(lockSelf); if (doorElement == null) { return; } this.PlaceIndex = doorElement.PlaceIndex; _room = doorElement.Room; this.UpdatePosition(); this.IsLock = true; this.LockColor = _section.GetLockColor(); this.DoorDirection = doorElement.Direction; _room.ReserveDoor(this.DoorDirection); _room.isLocked = true; if (_room.RoomType != RoomType.End || _room.RoomType != RoomType.Start) { _room.RoomType = RoomType.Room; } // Boss door - special case if ((DungeonBlockType)_room.DoorType[this.DoorDirection] == DungeonBlockType.BossDoor) { this.IsBossLock = true; this.AddDoor(this.DoorDirection, DungeonBlockType.BossDoor); } else { this.AddDoor(this.DoorDirection, DungeonBlockType.DoorWithLock); } if (lockSelf) { this.GetLockDoor().IsLocked = true; } }