From 42acd1c56acd3957763b44c9fc1ffcc6ed1fc23f Mon Sep 17 00:00:00 2001 From: Rich Dunne Date: Thu, 20 Aug 2020 16:27:50 -0600 Subject: [PATCH] Refactored fields and properties, extracted relevant functions from other classes and consolidated them here --- SceneManager/Object Classes/Path.cs | 57 ++++++++++++++++++++++++++--- 1 file changed, 51 insertions(+), 6 deletions(-) diff --git a/SceneManager/Object Classes/Path.cs b/SceneManager/Object Classes/Path.cs index aa8a761..feb035a 100644 --- a/SceneManager/Object Classes/Path.cs +++ b/SceneManager/Object Classes/Path.cs @@ -4,17 +4,17 @@ namespace SceneManager { public class Path { - public int PathNum; - public bool PathFinished; - public bool PathDisabled; - public List Waypoint = new List() { }; + public int PathNum { get; private set; } + public bool PathFinished { get; private set; } + public bool PathDisabled { get; private set; } + public List Waypoints = new List(); - public Path(int pathNum, bool pathFinished, bool pathDisabled, List waypointData) + public Path(int pathNum, bool pathFinished, bool pathDisabled, List waypoints) { PathNum = pathNum; PathFinished = pathFinished; PathDisabled = pathDisabled; - Waypoint = waypointData; + Waypoints = waypoints; } public Path(int pathNum, bool pathFinished) @@ -22,5 +22,50 @@ namespace SceneManager PathNum = pathNum; PathFinished = pathFinished; } + + public void SetPathNumber(int pathNum) + { + PathNum = pathNum; + } + + public void FinishPath() + { + PathFinished = true; + } + + public void DisablePath() + { + PathDisabled = true; + LowerWaypointBlipsOpacity(); + } + + private void LowerWaypointBlipsOpacity() + { + foreach (Waypoint wp in Waypoints) + { + wp.Blip.Alpha = 0.5f; + if (wp.CollectorRadiusBlip) + { + wp.CollectorRadiusBlip.Alpha = 0.25f; + } + } + } + + public void EnablePath() + { + PathDisabled = false; + } + + private void RestoreWaypointBlipsOpacity() + { + foreach (Waypoint wp in Waypoints) + { + wp.Blip.Alpha = 1.0f; + if (wp.CollectorRadiusBlip) + { + wp.CollectorRadiusBlip.Alpha = 0.5f; + } + } + } } }