private void AddDoor(int direction, DungeonBlockType doorType)
{
var door = _room.GetPuzzleDoor(direction);
// We'll create new door and replace if we want locked door instead of normal one here
if (door != null && doorType == DungeonBlockType.Door)
{
this.Doors[direction] = door;
return;
}
// Create new door
var floorData = this.Puzzle.FloorData;
var doorBlock = this.Puzzle.Dungeon.Data.Style.Get(doorType, direction);
var doorName = string.Format("{0}_door_{1}{2}_{3}", _name, this.X, this.Y, direction);
door = new Door(doorBlock.PropId, 0, this.X, this.Y, doorBlock.Rotation, doorType, doorName);
door.Info.Color1 = floorData.Color1;
door.Info.Color2 = floorData.Color2;
door.Info.Color3 = this.LockColor;
if (doorType == DungeonBlockType.BossDoor)
{
if (this.Puzzle.Dungeon.Data.BlockBoss)
door.BlockBoss = true;
door.Behavior += this.Puzzle.Dungeon.BossDoorBehavior;
}
door.Behavior += this.Puzzle.PuzzleEvent;
this.Doors[direction] = door;
this.Puzzle.Props[doorName] = door;
_room.SetPuzzleDoor(door, direction);
_room.SetDoorType(direction, (int)doorType);
}