RealWorldTerrainBuildingPrefab.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /* INFINITY CODE */
  2. /* https://infinity-code.com */
  3. using System;
  4. using System.Collections.Generic;
  5. using UnityEngine;
  6. namespace InfinityCode.RealWorldTerrain
  7. {
  8. [Serializable]
  9. public class RealWorldTerrainBuildingPrefab
  10. {
  11. public GameObject prefab;
  12. public List<OSMTag> tags;
  13. public SizeMode sizeMode = SizeMode.fitToBounds;
  14. public HeightMode heightMode = HeightMode.levelBased;
  15. public PlacementMode placementMode = PlacementMode.lowerCorner;
  16. public float fixedHeight = 15;
  17. public bool hasBounds
  18. {
  19. get { return prefab.GetComponent<Collider>() != null; }
  20. }
  21. [Serializable]
  22. public class OSMTag
  23. {
  24. public string key;
  25. public string value;
  26. public bool hasEmptyKey
  27. {
  28. get { return string.IsNullOrEmpty(key); }
  29. }
  30. public bool hasEmptyValue
  31. {
  32. get { return string.IsNullOrEmpty(value); }
  33. }
  34. public bool isEmpty
  35. {
  36. get { return hasEmptyKey && hasEmptyValue; }
  37. }
  38. }
  39. public enum SizeMode
  40. {
  41. originalSize,
  42. fitToBounds,
  43. }
  44. public enum HeightMode
  45. {
  46. original,
  47. averageXZ,
  48. levelBased,
  49. fixedHeight
  50. }
  51. public enum PlacementMode
  52. {
  53. lowerCorner,
  54. highestCorner,
  55. average,
  56. }
  57. }
  58. }