private MazeBlock BuildTileByChar(char type, Vector3Int pos) { if (Enum.IsDefined(typeof(MazeBlockType), (int)type)) { MazeBlockType enumVal = (MazeBlockType)type; return(BuildTileByType(enumVal, pos)); } return(null); }
private MazeBlock BuildTileByType(MazeBlockType type, Vector3Int pos) { MazeBlock origin = Array.Find(sourceTiles, el => el.type == type); if (origin != null) { switch (origin.type) { case MazeBlockType.OUTSIDE: return(new MB_Outside(origin, pos)); case MazeBlockType.DOOR_YELLOW: return(new MB_Door(origin, pos, GetYellowDoorKey())); case MazeBlockType.DOOR_RED: return(new MB_Door(origin, pos, GetRedDoorKey())); case MazeBlockType.DOOR_GREEN: return(new MB_Door(origin, pos, GetGreenDoorKey())); case MazeBlockType.DOOR_BUTTON_GREEN: return(new MB_DoorSwitch(origin, pos, GetGreenDoorKey())); case MazeBlockType.DOOR_BUTTON_RED: return(new MB_DoorSwitch(origin, pos, GetRedDoorKey())); case MazeBlockType.DOOR_BUTTON_YELLOW: return(new MB_DoorSwitch(origin, pos, GetYellowDoorKey())); case MazeBlockType.UNDER_ITEM: return(new MB_UnderItem(origin, pos)); default: return(new MazeBlock(origin, pos)); } } return(null); }
public MazeBlock(MazeBlock origin, Vector3Int _pos) { this.tileBases = origin.tileBases; this.type = origin.type; this.position = _pos; }