private void HandleOnPlayerLeft(PlayerComponent player) { PlayerSlotObject playerSlot = FindPlayerSlot(player); if (playerSlot == null) { return; } playerSlot.LeavePlayer(); }
private void HandleOnPlayerJoined(PlayerComponent player) { List <PlayerSlotObject> slots = playerSlots.OrderBy(x => x.Id).ToList(); for (int i = 0; i < slots.Count; i++) { PlayerSlotObject slot = slots[i]; if (!slot.IsTaken) { player.GetComponent <PlayerInput>().SwitchCurrentActionMap("UI"); // Give the player a unique model and color player.SwitchCharacterModel(playerModels[i]); player.PlayerColor = playerColors[i]; slot.JoinPlayer(player); break; } } }