41 lines
1.4 KiB
C#
41 lines
1.4 KiB
C#
using Continentis.MainGame.Character;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
namespace Continentis.MainGame.UI
|
|
{
|
|
public class CharacterAvatar : MonoBehaviour
|
|
{
|
|
public CharacterBase character;
|
|
public Image characterImage;
|
|
public Image frame;
|
|
|
|
public void Initialize(CharacterBase character)
|
|
{
|
|
this.character = character;
|
|
characterImage.sprite = character.data.avatar;
|
|
frame.color = MainGameManager.Instance.basePrefabs.fractionColors[character.fraction];
|
|
frame.material = Instantiate(frame.material);
|
|
Highlight(false);
|
|
}
|
|
|
|
public void Highlight(bool isHighlighted)
|
|
{
|
|
Debug.Log($"Highlighting {character.data.displayName}: {isHighlighted}");
|
|
|
|
if (isHighlighted)
|
|
{
|
|
frame.material.SetFloat("_SineGlowFade", 1);
|
|
frame.material.SetColor("_SineGlowColor", frame.color * 2);
|
|
}
|
|
else
|
|
{
|
|
frame.material.SetFloat("_SineGlowFade", 0);
|
|
frame.material.SetColor("_SineGlowColor", Color.white);
|
|
}
|
|
|
|
Mask mask = CombatUIManager.Instance.combatMainPage.actionOrderDisplayer.avatarContainer.GetComponent<Mask>();
|
|
MaskUtilities.NotifyStencilStateChanged(mask);
|
|
}
|
|
}
|
|
} |