// Start is called before the first frame update async void Update() { var command = await GetCommand(); if (command.action == "join") { spawnPlayer.SpawnNewPlayer(command.UserID, command.userName); } if (command.action == "chooseClass") { spawnPlayer.ChangeRole(command.UserID, command.clas); } if (command.action == "move") { Debug.Log("Moving"); spawnPlayer.MoveUnit(command.UserID, command.x, command.y); } if (command.action == "action") { if (command.builder == null) { spawnPlayer.PerformAction(command.UserID); } else { string[] bits = command.builder.Split('-'); string buildable = bits[0]; string pos = bits[1]; spawnPlayer.PerformAction(command.UserID, buildable, pos); } } }
// Start is called before the first frame update async void Update() { var command = await GetCommand(); if (command.action == "join") { spawnPlayer.SpawnNewPlayer(command.UserID, command.userName); } if (command.action == "chooseClass") { spawnPlayer.ChangeRole(command.UserID, command.clas); } if (command.action == "move") { spawnPlayer.MoveUnit(command.UserID, command.x, command.y); } if (command.action == "action") { //spawnPlayer.ChangeRole(command.UserID, command.clas); } }