fix convention

This commit is contained in:
hydrant
2019-09-12 19:40:36 +02:00
parent 063ced7b47
commit df82f8f291
4 changed files with 32 additions and 34 deletions

View File

@@ -14,17 +14,17 @@ namespace ReallifeGamemode.Server.Util
{
public class CheckPointHandle : Script
{
public static List<checkPointListForPlayer> listHandle = new List<checkPointListForPlayer>();
public static void startCheckPointRoute(Client player, List<Vector3> nListCps)
public static List<CheckPointListForPlayer> listHandle = new List<CheckPointListForPlayer>();
public static void StartCheckPointRoute(Client player, IEnumerable<Vector3> nListCps)
{
checkPointListForPlayer playerHandle = new checkPointListForPlayer(player, nListCps);
CheckPointListForPlayer playerHandle = new CheckPointListForPlayer(player, nListCps);
listHandle.Add(playerHandle);
playerHandle.startRoute();
playerHandle.StartRoute();
}
public static void removePlayerHandlerFromList(Client player)
public static void RemovePlayerHandlerFromList(Client player)
{
checkPointListForPlayer temp = null;
CheckPointListForPlayer temp = null;
for (int a = 0; a < listHandle.Count; a++)
{
temp = listHandle[a];
@@ -36,9 +36,9 @@ namespace ReallifeGamemode.Server.Util
}
[RemoteEvent("playerInCheckpoint")]
public void playerInCheckpoint(Client user)
public void PlayerInCheckpoint(Client user)
{
checkPointListForPlayer temp = null;
CheckPointListForPlayer temp = null;
for (int a = 0; a < listHandle.Count; a++)
{
temp = listHandle[a];
@@ -48,43 +48,45 @@ namespace ReallifeGamemode.Server.Util
}
}
temp.nextCheckpoint();
temp.NextCheckpoint();
ChatService.Broadcast("neuer cp");
}
}
public class checkPointListForPlayer
public class CheckPointListForPlayer
{
public List<Vector3> list = new List<Vector3>();
public IEnumerable<Vector3> list = new List<Vector3>();
public Client player;
Vector3 checkPoint;
Boolean done;
bool done;
int checkPointsDone = 0;
public checkPointListForPlayer(Client nPlayer, List<Vector3> nList)
public CheckPointListForPlayer(Client nPlayer, IEnumerable<Vector3> nList)
{
this.player = nPlayer;
this.list = nList;
}
public void startRoute()
public void StartRoute()
{
player.TriggerEvent("setCheckPoint", this.list.ElementAt(0), player);
}
public void nextCheckpoint()
public void NextCheckpoint()
{
this.checkPointsDone++;
if (this.list.Count > checkPointsDone)
if (this.list.Count() > checkPointsDone)
{
Vector3 nextCp = list.ElementAt(checkPointsDone);
ChatService.SendMessage(this.player, "cp set at " + nextCp.ToString());
this.player.TriggerEvent("setCheckPoint", nextCp, player);
}
if (this.list.Count == checkPointsDone)
if (this.list.Count() == checkPointsDone)
{
ChatService.SendMessage(this.player, "Du hast alle Checkpoints abgefahren!");
CheckPointHandle.removePlayerHandlerFromList(this.player);
CheckPointHandle.RemovePlayerHandlerFromList(this.player);
}
}
}