using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class PlayerColorRepresentation : MonoBehaviour
{
    
    public void SetColor(Player player, Image playerUI)
    {
        playerUI.gameObject.transform.Find("PlayerColor").GetComponent<Image>().color = player.Color;
        playerUI.gameObject.transform.Find("PlayerColor").FindChild("PlayerName").GetComponent<Text>().text = "Player " + player.PlayerColor.ToString();

        GetComponent<PlayerHealth>().healthSlider = playerUI.gameObject.transform.Find("HealthBar").GetComponent<Slider>();
        GetComponent<PlayerJetpack>().jetpackSlider = playerUI.gameObject.transform.Find("JetpackBar").GetComponent<Slider>();

        GetComponent<PlayerHealth>().numberOfKillsText = playerUI.gameObject.transform.Find("PanelKills").FindChild("TextKillValue").GetComponent<Text>();

        GetComponent<PlayerHealth>().numberOfKillsText.text = "0";

        GetComponent<PlayerController>().Init(player.PlayerId);
    }
}
