added pilot job

This commit is contained in:
2019-09-16 15:05:23 +02:00
parent d8cddb3411
commit b3d3d4550d
5 changed files with 59 additions and 14 deletions

View File

@@ -60,10 +60,10 @@ namespace ReallifeGamemode.Server.Job
{
if (type == "Kurz 1")
{
CheckPointHandle.StartCheckPointRoute(player, Route1);
CheckPointHandle.StartCheckPointRoute(player, Route1, 3000, 1);
} else if (type == "Kurz 2")
{
CheckPointHandle.StartCheckPointRoute(player, Route2);
CheckPointHandle.StartCheckPointRoute(player, Route2, 3000, 1);
}
}

View File

@@ -1,6 +1,11 @@
using System;
using System.Collections.Generic;
using System.Text;
using GTANetworkAPI;
using ReallifeGamemode.Server.Util;
using Newtonsoft.Json;
using GTANetworkAPI;
using ReallifeGamemode.Server.Services;
namespace ReallifeGamemode.Server.Job
{
@@ -11,5 +16,24 @@ namespace ReallifeGamemode.Server.Job
public override string Name => "Pilot";
public override bool NeedVehicleToStart => true;
private readonly IReadOnlyCollection<Vector3> Route1 = new List<Vector3>
{
new Vector3(-1059.862, -3100.353, 13.94444),
new Vector3(1690.651, 3246.769, 40.87084),
new Vector3(-2376.512, 3063.054, 32.82592),
new Vector3(2056.1, 4774.556, 4106039),
new Vector3(-1059.862, -3100.353, 13.94444),
}.AsReadOnly();
public PilotJob()
{
JobStart += PilotJob_JobStart;
}
private void PilotJob_JobStart(Client player)
{
CheckPointHandle.StartCheckPointRoute(player, Route1, 0, 6);
}
}
}

View File

@@ -15,9 +15,9 @@ namespace ReallifeGamemode.Server.Util
public class CheckPointHandle : Script
{
public static List<CheckPointListForPlayer> listHandle = new List<CheckPointListForPlayer>();
public static void StartCheckPointRoute(Client player, IEnumerable<Vector3> nListCps)
public static void StartCheckPointRoute(Client player, IEnumerable<Vector3> nListCps, int delay, int markerID)
{
CheckPointListForPlayer playerHandle = new CheckPointListForPlayer(player, nListCps);
CheckPointListForPlayer playerHandle = new CheckPointListForPlayer(player, nListCps, delay, markerID);
listHandle.Add(playerHandle);
playerHandle.StartRoute();
@@ -55,21 +55,25 @@ namespace ReallifeGamemode.Server.Util
{
public IEnumerable<Vector3> list = new List<Vector3>();
public Client player;
public int delay = 0;
public int markerID;
Vector3 checkPoint;
bool done;
int checkPointsDone = 0;
public CheckPointListForPlayer(Client nPlayer, IEnumerable<Vector3> nList)
public CheckPointListForPlayer(Client nPlayer, IEnumerable<Vector3> nList, int nDelay, int nMarkerID)
{
this.player = nPlayer;
this.list = nList;
this.delay = nDelay;
this.markerID = nMarkerID;
}
public void StartRoute()
{
player.TriggerEvent("setCheckPoint", this.list.ElementAt(0), player);
player.TriggerEvent("setCheckPoint", this.list.ElementAt(0), player, this.delay, this.markerID);
}
public void NextCheckpoint()
{
@@ -77,7 +81,7 @@ namespace ReallifeGamemode.Server.Util
if (this.list.Count() > checkPointsDone)
{
Vector3 nextCp = list.ElementAt(checkPointsDone);
this.player.TriggerEvent("setCheckPoint", nextCp, player);
this.player.TriggerEvent("setCheckPoint", nextCp, player, this.delay, this.markerID);
}
if (this.list.Count() == checkPointsDone)
{