// Make generic so different types of button interactions can be used, not just Maze Entry public void CreateMapInteractionButton(OverworldPlayerCharacter player, Vector2 pos, string mapText) { Logger.Log($"Create map interaction for player {player.PlayerNumber}"); GameObject mapInteractionButtonGO = GameObject.Instantiate(MapInteractionButtonPrefab, transform); MapInteractionButton mapInteractionButton = mapInteractionButtonGO.GetComponent <MapInteractionButton>(); mapInteractionButton.ShowMapInteractionButton(player, pos, mapText); MapInteractionButtons.Add(mapInteractionButton); player.MapInteractionButtonsForPlayer.Add(mapInteractionButton); }
public void DestroyMapMapInteractionButton(OverworldPlayerCharacter player) { Logger.Log($"Destroy map interaction label for player {player.PlayerNumber}"); for (int i = 0; i < MapInteractionButtons.Count; i++) { if (MapInteractionButtons[i].TriggerPlayer.PlayerNumber == player.PlayerNumber) { MapInteractionButton mapInteractionButton = MapInteractionButtons[i]; player.MapInteractionButtonsForPlayer.Remove(MapInteractionButtons[i]); MapInteractionButtons.Remove(MapInteractionButtons[i]); mapInteractionButton.DestroyMapInteractionButton(); break; } } }