feat: added delete/undo and cleaned up the name of the property that lets you set what object is being placed

This commit is contained in:
FreezeDriedMangoes 2022-05-12 14:15:44 -04:00
parent b7f3a587f7
commit 009d9b075a
2 changed files with 37 additions and 2 deletions

View File

@ -27,6 +27,7 @@ namespace NewHorizons.Utility
// placeholder currentObject
public static string currentObject = "BrittleHollow_Body/Sector_BH/Sector_NorthHemisphere/Sector_NorthPole/Sector_HangingCity/Sector_HangingCity_District1/Props_HangingCity_District1/OtherComponentsGroup/Props_HangingCity_Building_10/Prefab_NOM_VaseThin";
private static List<PropPlacementData> props = new List<PropPlacementData>();
private static List<PropPlacementData> deletedProps = new List<PropPlacementData>();
// TODO: RegisterProp function, call it in DetailBuilder.MakeDetail
// TODO: Add default rotation and position offsets
@ -118,5 +119,29 @@ namespace NewHorizons.Utility
Logger.Log(configFile);
}
}
public static void DeleteLast()
{
if (props.Count <= 0) return;
PropPlacementData last = props[props.Count-1];
props.RemoveAt(props.Count-1);
last.gameObject.SetActive(false);
deletedProps.Add(last);
}
public static void UndoDelete()
{
if (deletedProps.Count <= 0) return;
PropPlacementData last = deletedProps[deletedProps.Count-1];
deletedProps.RemoveAt(deletedProps.Count-1);
last.gameObject.SetActive(true);
props.Add(last);
}
}
}

View File

@ -18,7 +18,7 @@ namespace NewHorizons.Utility
private GameObject _normalSphere1;
private GameObject _normalSphere2;
public string temp_placepath = "BrittleHollow_Body/Sector_BH/Sector_NorthHemisphere/Sector_NorthPole/Sector_HangingCity/Sector_HangingCity_District1/Props_HangingCity_District1/OtherComponentsGroup/Props_HangingCity_Building_10/Prefab_NOM_VaseThin";
public string PropToPlace = "BrittleHollow_Body/Sector_BH/Sector_NorthHemisphere/Sector_NorthPole/Sector_HangingCity/Sector_HangingCity_District1/Props_HangingCity_District1/OtherComponentsGroup/Props_HangingCity_Building_10/Prefab_NOM_VaseThin";
private void Awake()
{
@ -44,7 +44,7 @@ namespace NewHorizons.Utility
if (Keyboard.current[Key.L].wasReleasedThisFrame)
{
DebugPropPlacer.currentObject = temp_placepath;
DebugPropPlacer.currentObject = PropToPlace;
PlaceObject();
}
@ -52,6 +52,16 @@ namespace NewHorizons.Utility
{
DebugPropPlacer.PrintConfig();
}
if (Keyboard.current[Key.Minus].wasReleasedThisFrame)
{
DebugPropPlacer.DeleteLast();
}
if (Keyboard.current[Key.Equals].wasReleasedThisFrame)
{
DebugPropPlacer.UndoDelete();
}
}
internal void PlaceObject()