Exemple #1
0
        private void AssignSpawn(int connectionID, Team team, bool respawn = false)
        {
            GameObject spawn;

            if (respawn)
            {
                spawn = GetRespawnPosition(team);
            }
            else
            {
                spawn = GetInitialSpawnPosition(team);
            }

            PlayerSpawn playerSpawn = PlayerSpawn.Create();

            playerSpawn.ConnectionID  = connectionID;
            playerSpawn.SpawnPosition = spawn.transform.position;
            playerSpawn.SpawnRotation = spawn.transform.rotation;
            playerSpawn.RoomToken     = RoomInfoToken;
            playerSpawn.TeamEnum      = (int)team;
            playerSpawn.GameStarted   = _gameIsStarted;
            playerSpawn.Send();

            if (!respawn)
            {
                IncreaseSpawnCount();
            }
        }