From fc76ea1f80a9cb1c054c94d11f4c333c5e2d5922 Mon Sep 17 00:00:00 2001 From: Rich Dunne Date: Wed, 26 Aug 2020 04:38:47 -0600 Subject: [PATCH] Replaced Path's IsFinished bool with State enum --- SceneManager/Menus/PathMainMenu.cs | 16 +--------- SceneManager/Object Classes/Path.cs | 45 ++++++++++++++++------------- 2 files changed, 26 insertions(+), 35 deletions(-) diff --git a/SceneManager/Menus/PathMainMenu.cs b/SceneManager/Menus/PathMainMenu.cs index 3ff1fd4..ad5223b 100644 --- a/SceneManager/Menus/PathMainMenu.cs +++ b/SceneManager/Menus/PathMainMenu.cs @@ -179,27 +179,13 @@ namespace SceneManager // For each element in paths, determine if the element exists but is not finished yet, or if it doesn't exist, create it. for (int i = 0; i <= paths.Count; i++) { - if (paths.ElementAtOrDefault(i) != null && paths[i].PathFinished == false) + if (paths.ElementAtOrDefault(i) != null && paths[i].State == State.Creating) { //Game.LogTrivial($"pathFinished: {paths[i].PathFinished}"); Game.LogTrivial($"Resuming path {paths[i].PathNum}"); Game.DisplayNotification($"~o~Scene Manager\n~y~[Creating]~w~ Resuming path {paths[i].PathNum}"); break; } - //else if (paths.ElementAtOrDefault(i) == null) - //{ - // Do we only want to do this once the first waypoint is added ? - // PathCreationMenu.AddNewPathToPathsCollection(paths, i); - - // if (SettingsMenu.debugGraphics.Checked) - // { - // GameFiber.StartNew(() => - // { - // DebugGraphics.LoopToDrawDebugGraphics(SettingsMenu.debugGraphics, paths[i]); - // }); - // } - // break; - //} } } diff --git a/SceneManager/Object Classes/Path.cs b/SceneManager/Object Classes/Path.cs index 3a4921f..22991cc 100644 --- a/SceneManager/Object Classes/Path.cs +++ b/SceneManager/Object Classes/Path.cs @@ -2,18 +2,19 @@ namespace SceneManager { - public enum Status + public enum State { - IsEnabled, - IsDisabled + Uninitialized, + Creating, + Finished } public class Path { public int PathNum { get; private set; } - public bool PathFinished { get; private set; } + //public bool PathFinished { get; private set; } public bool IsEnabled { get; private set; } - public Status Status { get; private set; } + public State State { get; set; } public List Waypoints = new List(); @@ -41,16 +42,10 @@ namespace SceneManager PathNum = pathNum; } - public void FinishPath() - { - PathFinished = true; - } - - public void DisablePath() - { - IsEnabled = false; - LowerWaypointBlipsOpacity(); - } + //public void FinishPath() + //{ + // PathFinished = true; + //} private void LowerWaypointBlipsOpacity() { @@ -64,11 +59,6 @@ namespace SceneManager } } - public void EnablePath() - { - IsEnabled = true; - } - private void RestoreWaypointBlipsOpacity() { foreach (Waypoint wp in Waypoints) @@ -80,5 +70,20 @@ namespace SceneManager } } } + + public void DisablePath() + { + IsEnabled = false; + LowerWaypointBlipsOpacity(); + } + + public void EnablePath() + { + IsEnabled = true; + } + + + + } }