From 07bb1a577be5cbc7a1830a776f18cae200ab855f Mon Sep 17 00:00:00 2001 From: Rich Dunne Date: Sat, 15 May 2021 09:54:36 -0600 Subject: [PATCH] Changed Number property to internal, added getter method --- SceneManager/Waypoints/Waypoint.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/SceneManager/Waypoints/Waypoint.cs b/SceneManager/Waypoints/Waypoint.cs index 2e62513..62d6de0 100644 --- a/SceneManager/Waypoints/Waypoint.cs +++ b/SceneManager/Waypoints/Waypoint.cs @@ -12,7 +12,7 @@ namespace SceneManager.Waypoints public class Waypoint // Change this and select properties to Public for import/export { internal Path Path { get; set; } - public int Number { get; set; } + internal int Number { get => Path.Waypoints.IndexOf(this) + 1; set { } } public Vector3 Position { get; set; } public float Speed { get; set; } public DrivingFlagType DrivingFlagType { get; set; } @@ -27,10 +27,9 @@ namespace SceneManager.Waypoints private Waypoint() { } - internal Waypoint(Path path, int waypointNumber, Vector3 waypointPosition, float speed, DrivingFlagType drivingFlag, bool stopWaypoint, bool collector = false, float collectorRadius = 1, float speedZoneRadius = 5) + internal Waypoint(Path path, Vector3 waypointPosition, float speed, DrivingFlagType drivingFlag, bool stopWaypoint, bool collector = false, float collectorRadius = 1, float speedZoneRadius = 5) { Path = path; - Number = waypointNumber; Position = waypointPosition; Speed = speed; DrivingFlagType = drivingFlag; @@ -56,6 +55,8 @@ namespace SceneManager.Waypoints } } + Path.Waypoints.Add(this); + Game.LogTrivial($"Path {Path.Name} Waypoint {Number} added [Driving style: {DrivingFlagType} | Stop waypoint: {IsStopWaypoint} | Speed: {Speed} | Collector: {IsCollector}]"); DrawWaypointMarker(); }