Ejemplo n.º 1
0
    void InitPalette()
    {
        GameObject owner = m_Logic.GetOwner();

        if (owner != null)
        {
            PlayerInfoComponent infoComp = owner.GetComponent <PlayerInfoComponent>();
            if (infoComp != null)
            {
                infoComp.InitWithCurrentPalette(m_SpriteRenderer.material);
            }
        }
    }
Ejemplo n.º 2
0
    private void OnPlayerRegistered(GameObject player)
    {
        PlayerInfoComponent infoComponent = player.GetComponent <PlayerInfoComponent>();

        if (infoComponent != null)
        {
            m_PlayerName.SetText(infoComponent.m_InfoConfig.m_PlayerName);
            m_PlayerIcon.sprite = infoComponent.m_InfoConfig.m_PlayerIcon;

            Material instianciatedMaterial = Instantiate(m_PlayerIcon.material); // By default Image material is shared...
            infoComponent.InitWithCurrentPalette(instianciatedMaterial);
            m_PlayerIcon.material = instianciatedMaterial;
        }
    }