mirror of
https://github.com/thegeneralist01/Scene-Manager-DevRepo
synced 2026-01-11 23:50:29 +01:00
105 lines
3 KiB
C#
105 lines
3 KiB
C#
using Rage;
|
|
using System.Collections.Generic;
|
|
using System.Drawing;
|
|
|
|
namespace SceneManager
|
|
{
|
|
public class Path
|
|
{
|
|
internal int Number { get; set; }
|
|
internal bool IsEnabled { get; set; }
|
|
internal State State { get; set; }
|
|
internal List<Waypoint> Waypoints = new List<Waypoint>();
|
|
|
|
internal Path(int pathNum, State pathState)
|
|
{
|
|
Number = pathNum;
|
|
State = pathState;
|
|
DrawLinesBetweenWaypoints();
|
|
}
|
|
|
|
private void LowerWaypointBlipsOpacity()
|
|
{
|
|
foreach (Waypoint wp in Waypoints)
|
|
{
|
|
wp.Blip.Alpha = 0.5f;
|
|
if (wp.CollectorRadiusBlip)
|
|
{
|
|
wp.CollectorRadiusBlip.Alpha = 0.25f;
|
|
}
|
|
}
|
|
}
|
|
|
|
private void RestoreWaypointBlipsOpacity()
|
|
{
|
|
foreach (Waypoint wp in Waypoints)
|
|
{
|
|
if (wp.Blip)
|
|
{
|
|
wp.Blip.Alpha = 1.0f;
|
|
if (wp.CollectorRadiusBlip)
|
|
{
|
|
wp.CollectorRadiusBlip.Alpha = 0.5f;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
internal void DisablePath()
|
|
{
|
|
IsEnabled = false;
|
|
foreach(Waypoint wp in Waypoints)
|
|
{
|
|
wp.RemoveSpeedZone();
|
|
}
|
|
if (SettingsMenu.mapBlips.Checked)
|
|
{
|
|
LowerWaypointBlipsOpacity();
|
|
}
|
|
}
|
|
|
|
internal void EnablePath()
|
|
{
|
|
IsEnabled = true;
|
|
foreach (Waypoint wp in Waypoints)
|
|
{
|
|
if (wp.IsCollector)
|
|
{
|
|
wp.AddSpeedZone();
|
|
}
|
|
}
|
|
if (SettingsMenu.mapBlips.Checked)
|
|
{
|
|
RestoreWaypointBlipsOpacity();
|
|
}
|
|
}
|
|
|
|
internal void DrawLinesBetweenWaypoints()
|
|
{
|
|
GameFiber.StartNew(() =>
|
|
{
|
|
while (SettingsMenu.threeDWaypoints.Checked)
|
|
{
|
|
if (MenuManager.menuPool.IsAnyMenuOpen())
|
|
{
|
|
for (int i = 0; i < Waypoints.Count; i++)
|
|
{
|
|
if (i != Waypoints.Count - 1)
|
|
{
|
|
if (Waypoints[i + 1].IsStopWaypoint)
|
|
{
|
|
Debug.DrawLine(Waypoints[i].Position, Waypoints[i + 1].Position, Color.Orange);
|
|
}
|
|
else
|
|
{
|
|
Debug.DrawLine(Waypoints[i].Position, Waypoints[i + 1].Position, Color.Green);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
GameFiber.Yield();
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}
|