// USED public void RemoveDriverBot() { // if there is a gunner bot on our team, then remove it from our team and remove it from the gamestate tracker TeamEntry teamEntry = gamestateTracker.teams.Get((short)teamId); if (teamEntry.driverId != 0) { PlayerEntry playerEntry = gamestateTracker.players.Get(teamEntry.driverId); if (playerEntry.isBot) { playerEntry.Delete(); } else { playerEntry.Release(); } } teamEntry.driverId = 0; teamEntry.Commit(); }
// called by the lobby button master when we create a team public bool TeamRemoveEntry() { lobbySlotMaster = FindObjectOfType <LobbySlotMaster>(); gamestateTracker = FindObjectOfType <GamestateTracker>(); TeamEntry teamEntry = gamestateTracker.teams.Get((short)teamId); bool canRemove = true; // look for the corresponding players in the team // get driver player (if they exist) short driverId = teamEntry.driverId; if (driverId != 0) { PlayerEntry driverEntry = gamestateTracker.players.Get((short)driverId); // if they are bots, then kick them if (driverEntry.isBot) { driverEntry.Delete(); } // unready and unselect them else { canRemove = false; driverEntry.Release(); } } // get gunner player (if they exist) short gunnerId = teamEntry.gunnerId; if (gunnerId != 0) { PlayerEntry gunnerEntry = gamestateTracker.players.Get((short)gunnerId); if (gunnerEntry.isBot) { gunnerEntry.Delete(); } // unready and unselect them else { canRemove = false; gunnerEntry.Release(); } } if (canRemove) { Debug.Log("Deleting team entry"); teamEntry.Delete(); } else { teamEntry.Release(); } return(canRemove); }