CrossingExtras.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. using System;
  2. using Routes;
  3. using UnityEngine;
  4. namespace Roads
  5. {
  6. [Serializable]
  7. public struct CrossingData
  8. {
  9. public Transform west;
  10. public Transform north;
  11. public Transform east;
  12. public Transform south;
  13. }
  14. public class CrossingExtras : Turn
  15. {
  16. public CrossingData crossingData;
  17. protected override Transform RoadDirectionToTransform(RoadDirection position)
  18. {
  19. switch (position)
  20. {
  21. case RoadDirection.North:
  22. return crossingData.north;
  23. case RoadDirection.West:
  24. return crossingData.west;
  25. case RoadDirection.East:
  26. return crossingData.east;
  27. case RoadDirection.South:
  28. return crossingData.south;
  29. case RoadDirection.None:
  30. throw new ArgumentException("RoadDirection.None not allowed for adding arrows");
  31. default:
  32. throw new ArgumentOutOfRangeException(nameof(position), position, "Wrong Argument for AddArrows");
  33. }
  34. }
  35. }
  36. }