chip-gameV3/Assets/Scripts/Characters/CharacterPlayAllReplicas.cs
2026-07-14 11:14:13 +03:00

57 lines
1.7 KiB
C#

using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
public class CharacterPlayAllReplicas : MonoBehaviour
{
[SerializeField] Character character;
List<List<Replica>> replicas;
public TextMeshProUGUI label;
List<string> labelValues = new List<string> {"появление",
"ход игрока",
"ход бота",
"победа игрока",
"победа бота",
"возвращение",
"ничья", };
void Start()
{
replicas = new();
character.Animator.SetTrigger("Appear");
replicas.Add(character.appearReplicas);
replicas.Add(character.playerTurnReplicas);
replicas.Add(character.botTurnReplicas);
replicas.Add(character.playerWinReplicas);
replicas.Add(character.botWinReplicas);
replicas.Add(character.returnReplicas);
replicas.Add(character.drawReplicas);
StartCoroutine(showAllReplicas(1));
}
public IEnumerator showAllReplicas(float delay)
{
for (int i = 0; i < replicas.Count; i++)
{
yield return new WaitForSeconds(delay*3);
label.text = labelValues[i];
foreach (var replica in replicas[i])
{
character.Message(replica);
yield return new WaitForSeconds(character.culldownTime+replica.clip.length);
}
}
yield return null;
}
}