public static Color GetOutlineColor(WorldObjects.Spaces.Space space) { if (space is Corridor) { return(Color.red); } else if (space is Shaft) { return(Color.green); } else if (space is MonsterDen) { return(Color.white); } else if (space is TreasureRoom) { return(Color.yellow); } else if (space is Room) { return(Color.black); } else if (space is Laboratory) { return(Color.gray); } else { throw new System.ArgumentOutOfRangeException($"No color assigned for {space.GetType()}."); } }
public void InitializeFromSpace(Space space) { InitializeFromSpaceRaw(space); InitializeEnemySpawns(space.EnemySpawns); InitializeBlockOverrides(space.BlockOverrides); }
private void DrawSpace(WorldObjects.Spaces.Space space, string prefixName = "") { if (space is Corridor) { Gizmos.color = Color.red; } else if (space is Shaft) { Gizmos.color = Color.green; } else if (space is MonsterDen) { Gizmos.color = Color.white; } else if (space is TreasureRoom) { Gizmos.color = Color.yellow; } else if (space is Room) { Gizmos.color = Color.black; } else if (space is Laboratory) { Gizmos.color = Color.gray; } DrawByExtents(space.Extents); Handles.Label(space.Extents[0], $"{prefixName} {space.Name}"); if (space is ComplexSpace) { var complexSpace = space as ComplexSpace; for (var regionNumber = 0; regionNumber < complexSpace.Regions.Count; regionNumber++) { var region = complexSpace.Regions[regionNumber]; for (var spaceNumber = 0; spaceNumber < region.Spaces.Count; spaceNumber++) { DrawSpace(region.Spaces[spaceNumber]); } } } }
protected override void InitializeFromSpaceRaw(Space space) { var laboratory = space as Laboratory; foreach (var region in laboratory.Regions) { var mainShaft = region.Spaces[0]; var mainShaftCrafter = SpaceCraftingManager.Instance.AddNewCrafter <ShaftCrafter>(); mainShaftCrafter.transform.SetParent(transform); mainShaftCrafter.InitializeFromSpace(mainShaft); for (var spaceNumber = 1; spaceNumber < region.Spaces.Count; spaceNumber++) { var regionSpace = region.Spaces[spaceNumber]; SpaceCrafter crafter; if (regionSpace is Shaft) { crafter = SpaceCraftingManager.Instance.AddNewCrafter <ShaftCrafter>(); } else if (regionSpace is Corridor) { crafter = SpaceCraftingManager.Instance.AddNewCrafter <CorridorCrafter>(); } else if (regionSpace is Room) { crafter = SpaceCraftingManager.Instance.AddNewCrafter <RoomCrafter>(); } else { throw new System.ArgumentOutOfRangeException($"Unhandled space of type {region.GetType()}."); } crafter.transform.SetParent(mainShaftCrafter.transform); crafter.InitializeFromSpace(regionSpace); } } }
private static void LogCustomSpace(WorldObjects.Spaces.Space customSpace) { if (customSpace is ComplexSpace) { var complexSpace = customSpace as ComplexSpace; foreach (var region in complexSpace.Regions) { foreach (var regionSpace in region.Spaces) { var history = CreateHistory(); history.LogChange(regionSpace); _timeline.Add(history); } } } else { var history = CreateHistory(); history.LogChange(customSpace); _timeline.Add(history); } }
protected abstract void InitializeFromSpaceRaw(Space space);