54 lines
1.6 KiB
C#
54 lines
1.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using RAGE;
|
|
using RAGE.Elements;
|
|
|
|
namespace ReallifeGamemode.Client.Jobs.BusDriver
|
|
{
|
|
public static class CheckpointHelper
|
|
{
|
|
public static List<CheckpointInstance> Checkpoints = new List<CheckpointInstance>();
|
|
|
|
public static void ClearAllCheckpoints()
|
|
{
|
|
while (Checkpoints.Count != 0)
|
|
{
|
|
Checkpoints[Checkpoints.Count - 1].Delete();
|
|
Checkpoints.Remove(Checkpoints[Checkpoints.Count - 1]);
|
|
}
|
|
}
|
|
|
|
public static void ClearCheckpoint(CheckpointInstance checkpointInstance)
|
|
{
|
|
checkpointInstance.Delete();
|
|
}
|
|
|
|
public static CheckpointInstance IsNearCheckpoint(float distance)
|
|
{
|
|
return Checkpoints.Find(checkpoint => checkpoint.Checkpoint.Position.DistanceTo2D(Player.LocalPlayer.Position) <= distance);
|
|
}
|
|
}
|
|
|
|
public class CheckpointInstance
|
|
{
|
|
public Checkpoint Checkpoint { get; set; } = null;
|
|
public bool RecentlyPlaced = true;
|
|
public float Size = 5f;
|
|
|
|
public CheckpointInstance(Vector3 position, float size)
|
|
{
|
|
Checkpoint = new Checkpoint(1, position.Subtract(new Vector3(0, 0, 1)), size, new Vector3(), new RGBA(255, 255, 255, 155), true, 0);
|
|
Size = size;
|
|
CheckpointHelper.Checkpoints.Add(this);
|
|
}
|
|
|
|
public void Delete()
|
|
{
|
|
Checkpoint.Destroy();
|
|
CheckpointHelper.Checkpoints.Remove(this);
|
|
RAGE.Game.Audio.PlaySoundFrontend(1, "Beep_Red", "DLC_HEIST_HACKING_SNAKE_SOUNDS", true);
|
|
}
|
|
}
|
|
}
|