ObjectPlacementPathManualHeightAdjuster.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #if UNITY_EDITOR
  2. using UnityEngine;
  3. using System.Collections.Generic;
  4. namespace O3DWB
  5. {
  6. public class ObjectPlacementPathManualHeightAdjuster
  7. {
  8. #region Public Methods
  9. public int Raise(ObjectPlacementPath path, int currentPathHeight)
  10. {
  11. currentPathHeight += path.Settings.ManualConstructionSettings.HeightAdjustmentSettings.ManualHeightAdjustmentSettings.RaiseAmount;
  12. ObjectPlacementBoxStackSegmentActions.SetHeightForSegments(path.GetAllSegments(), currentPathHeight);
  13. return currentPathHeight;
  14. }
  15. public int Lower(ObjectPlacementPath path, int currentPathHeight)
  16. {
  17. currentPathHeight -= path.Settings.ManualConstructionSettings.HeightAdjustmentSettings.ManualHeightAdjustmentSettings.LowerAmount;
  18. ObjectPlacementBoxStackSegmentActions.SetHeightForSegments(path.GetAllSegments(), currentPathHeight);
  19. return currentPathHeight;
  20. }
  21. public void AdjustHeightForSegments(List<ObjectPlacementBoxStackSegment> segments, int desiredHeight)
  22. {
  23. foreach(ObjectPlacementBoxStackSegment segment in segments)
  24. {
  25. AdjustSegmentHeight(segment, desiredHeight);
  26. }
  27. }
  28. public void AdjustSegmentHeight(ObjectPlacementBoxStackSegment segment, int desiredHeight)
  29. {
  30. segment.SetHeightForAllStacks(desiredHeight);
  31. }
  32. public void AdjustSegmentHeight(ObjectPlacementBoxStackSegment segment, int indexOfFirstStackToAdjust, int desiredHeight)
  33. {
  34. segment.SetHeightForStacksStartingAt(indexOfFirstStackToAdjust, desiredHeight);
  35. }
  36. #endregion
  37. }
  38. }
  39. #endif