Snaparazzi/Assets/Scripts/ScoringPage.cs
2024-02-01 23:41:14 +01:00

35 lines
963 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ScoringPage : MonoBehaviour
{
[SerializeField] private List<PlayerSticker> playerStickers;
private void Awake()
{
if(playerStickers == null || playerStickers.Count == 0)
{
Debug.LogError("You must provide the player stickers to the Scoring Page", this);
}
}
public void Initialize(Room _room)
{
AudioManager.Instance.ChangeMusic(MusicTitle.Ending);
gameObject.SetActive(true);
foreach(PlayerSticker p in playerStickers)
{
p.gameObject.SetActive(false);
}
gameObject.SetActive(true);
Player[] players = _room.GetOrderedPlayerList().ToArray();
for (int i = 0; i < players.Length; i++)
{
playerStickers[i].gameObject.SetActive(true);
playerStickers[i].Initialize(players[i].name, i);
}
}
}