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); }
public void OnEnable() { botsLeftToRemove = BotsToRemove; removeDelayCounter = RemoveDelay; remoteBotPlayers.Clear(); CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>(); DataEntityHandle[] remotePlayerHandles = cPDataEntityCollection.GetRemotePlayerHandles(); int num = remotePlayerHandles.Length; for (int i = 0; i < num; i++) { if (cPDataEntityCollection.TryGetComponent <DisplayNameData>(remotePlayerHandles[i], out var component)) { RemotePlayerBot component2 = RemotePlayerBotUtil.GetBotContainer().Find(component.DisplayName).GetComponent <RemotePlayerBot>(); remoteBotPlayers.Add(component2); } } }