mirror of
https://github.com/thegeneralist01/Scene-Manager-DevRepo
synced 2026-01-11 07:30:40 +01:00
Path object now has it's own list of collected vehicles.
This commit is contained in:
parent
066395666c
commit
072d19d643
1 changed files with 27 additions and 0 deletions
|
|
@ -1,6 +1,7 @@
|
|||
using Rage;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
|
||||
namespace SceneManager
|
||||
{
|
||||
|
|
@ -10,6 +11,7 @@ namespace SceneManager
|
|||
internal bool IsEnabled { get; set; }
|
||||
internal State State { get; set; }
|
||||
internal List<Waypoint> Waypoints = new List<Waypoint>();
|
||||
internal List<CollectedVehicle> CollectedVehicles = new List<CollectedVehicle>();
|
||||
|
||||
internal Path(int pathNum, State pathState)
|
||||
{
|
||||
|
|
@ -101,5 +103,30 @@ namespace SceneManager
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
internal void LoopForVehiclesToBeDismissed()
|
||||
{
|
||||
GameFiber.StartNew(() =>
|
||||
{
|
||||
while (PathMainMenu.paths.Contains(this))
|
||||
{
|
||||
//Logger.Log($"Dismissing unused vehicles for cleanup");
|
||||
foreach (CollectedVehicle cv in CollectedVehicles.Where(cv => cv.Vehicle))
|
||||
{
|
||||
if (!cv.Vehicle.IsDriveable || cv.Vehicle.IsUpsideDown || !cv.Vehicle.HasDriver)
|
||||
{
|
||||
if (cv.Vehicle.HasDriver)
|
||||
{
|
||||
cv.Vehicle.Driver.Dismiss();
|
||||
}
|
||||
cv.Vehicle.Dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
CollectedVehicles.RemoveAll(cv => !cv.Vehicle);
|
||||
GameFiber.Sleep(60000);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue