private void MovePlayerToLocation_Internal(Staircase sendingStairs, DungeonLocation location, bool suppressMovementEvents) { if (location == null) { location = sendingStairs.Destination; } // Make sure that this dungeon branch does in fact exist. if (DungeonBranches.Contains(location.Branch)) { SetCurrentBranch(location.Branch, suppressMovementEvents); if (!CurrentBranch.DungeonLevelExists(location.DungeonBranchLevel)) { CurrentBranch.CreateNewLevel(location.DungeonBranchLevel); if (sendingStairs != null) { // The map position shoud be populated on the staircase now. location = sendingStairs.Destination; } } CurrentMapState = CurrentBranch.GetDungeonLevel(location.DungeonBranchLevel); Game.Current.Player.Position = location.MapPosition; // Update the dungeon level. CurrentDungeonLevel = _dungeonBranches[CurrentBranch] + CurrentMapState.DungeonBranchIndex; } else { throw new InvalidOperationException(string.Format(ErrorMessages.DungeonBranchNotFound, location.Branch.Name)); } }
protected override void ConsumeInternal(int count) { AssertHasBranch(); CurrentBranch.Consume(count); }