59 lines
1.4 KiB
C#
59 lines
1.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using GTANetworkAPI;
|
|
|
|
namespace ReallifeGamemode.Server.Job.BusDriver
|
|
{
|
|
public class JobInfo
|
|
{
|
|
public Queue<ObjectiveInfo> Objectives = new Queue<ObjectiveInfo>();
|
|
public Client Owner { get; set; }
|
|
|
|
|
|
public void AddObjective(Vector3 position, float size)
|
|
{
|
|
ObjectiveInfo objectiveInfo = new ObjectiveInfo();
|
|
objectiveInfo.Position = position;
|
|
objectiveInfo.Size = size;
|
|
|
|
Objectives.Enqueue(objectiveInfo);
|
|
}
|
|
|
|
public void StartJob(Client client)
|
|
{
|
|
Owner = client;
|
|
NextObjective(client);
|
|
|
|
client.SetData("Job", this);
|
|
}
|
|
|
|
public void NextObjective(Client client)
|
|
{
|
|
ObjectiveInfo next_objective = Objectives.Peek();
|
|
client.TriggerEvent("load_objective", next_objective.Position, next_objective.Size);
|
|
}
|
|
|
|
public void CheckObjective(Client client)
|
|
{
|
|
ObjectiveInfo current_objective = Objectives.Peek();
|
|
|
|
if (!current_objective.IsInObjective(client))
|
|
return;
|
|
|
|
Objectives.Dequeue();
|
|
|
|
if (Objectives.Count == 0)
|
|
{
|
|
client.SendNotification("Du hast alle ~r~Haltestellen ~w~ abgefahren.");
|
|
client.SendNotification("Fahre zurück zum Busbahnhof und bringe deinen Bus zurück.");
|
|
client.TriggerEvent("clear_all_markers");
|
|
|
|
return;
|
|
}
|
|
|
|
NextObjective(client);
|
|
}
|
|
}
|
|
}
|