Files
pgs/Assets/Scripts/UI/CGLayerController.cs

33 lines
889 B
C#
Raw Permalink Normal View History

2026-02-21 16:58:22 -08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class CGLayerController : MonoBehaviour
{
[SerializeField] public List<SpriteRenderer> images;
public static Color notTalkingColor = new Color(0.5f, 0.5f, 0.5f, 1f);
public void SetActiveImage(int activeIndex) {
for (int i = 0; i < images.Count; i++) {
// Non-active layers should be disabled.
if (i == activeIndex) {
images[i].enabled = true;
} else {
images[i].enabled = false;
}
}
}
public void SetIsTalking(bool isTalking) {
for (int i = 0; i < images.Count; i++) {
if (isTalking) {
images[i].color = Color.white;
} else {
images[i].color = notTalkingColor;
}
}
}
}