Files
Crash-Course/Assets/Scripts/Game/CreatePlayerJoinCards.cs

29 lines
738 B
C#
Raw Normal View History

2025-04-16 19:57:54 -04:00
using UnityEngine; using Game; using Music; using Player;
2025-02-16 16:47:45 -05:00
using UnityEngine.InputSystem;
2025-04-16 19:57:54 -04:00
namespace Game
2025-02-16 16:47:45 -05:00
{
2025-04-16 19:57:54 -04:00
public class PlayerCardCreator : MonoBehaviour
2025-02-16 16:47:45 -05:00
{
2025-04-16 19:57:54 -04:00
public static PlayerCardCreator Instance;
public GameObject playerJoinCardPrefab;
private void Awake() // Ensures only one instance of PlayerCardCreator exists
2025-02-16 16:47:45 -05:00
{
2025-04-16 19:57:54 -04:00
if (Instance == null) Instance = this;
else
{
Destroy(gameObject);
}
2025-02-16 16:47:45 -05:00
}
2025-04-16 19:57:54 -04:00
public PlayerJoinCard CreateCard() // Creates a player join card
{
GameObject card = Instantiate(playerJoinCardPrefab, transform);
return card.GetComponent<PlayerJoinCard>();
}
2025-02-16 16:47:45 -05:00
}
}