private void removeBot() { if (remoteBotPlayers.Count > 0) { RemotePlayerBot remotePlayerBot = remoteBotPlayers[0]; remotePlayerBot.Remove(0f); remoteBotPlayers.RemoveAt(0); } botsLeftToRemove--; }
private bool onRemotePlayerJoinedRoom(NetworkControllerEvents.RemotePlayerJoinedRoomEvent evt) { if (Service.Get <CPDataEntityCollection>().TryGetComponent <DisplayNameData>(evt.Handle, out var component) && component.DisplayName.StartsWith(BotName)) { Transform botContainer = RemotePlayerBotUtil.GetBotContainer(); GameObject gameObject = new GameObject(component.DisplayName); gameObject.transform.SetParent(botContainer); RemotePlayerBot remotePlayerBot = gameObject.AddComponent <RemotePlayerBot>(); remotePlayerBot.Handle = evt.Handle; remotePlayerBot.RandomizeClothing(); remotePlayerBot.RandomizeColor(); remotePlayerBot.RandomizePosition(base.transform.position, SpawnRadius); if (AutoRemove) { remotePlayerBot.Remove(UnityEngine.Random.Range(0.2f, 10f)); } } return(false); }