void Start() { if (playerRoster.items.Count == 0) { inputSchemeMonitor.StartMonitor(); } else { foreach (PlayerInfo playerInfo in playerRoster.items) { OnAddPlayer.Invoke(playerInfo); } } }
void Update() { for (int i = availableInputSchemes.items.Count - 1; i >= 0; i--) { if (playerRoster.FreeSlots() == 0) { PauseMonitor(); break; } InputScheme inputScheme = availableInputSchemes.items[i]; if (inputScheme.GetInputDirection() != Vector2.zero) { availableInputSchemes.UnregisterItem(inputScheme); takenInputSchemes.RegisterItem(inputScheme); PlayerInfo playerInfo = Instantiate(defaultPlayerInfo); playerInfo.inputScheme.Value = inputScheme; playerRoster.RegisterItem(playerInfo); OnDetectNewPlayer.Invoke(playerInfo); } } }