33 lines
889 B
C#
33 lines
889 B
C#
|
|
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;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|