49 lines
1.3 KiB
C#
49 lines
1.3 KiB
C#
using UnityEngine;
|
|
using System;
|
|
|
|
public class EventPartnerStatueDiceGroup : MonoBehaviour
|
|
{
|
|
[SerializeField] private EventPartnerStatueDiceView[] dices;
|
|
[SerializeField] private EventPartnerStatueDiceView diceInto;
|
|
public int DiceCount => dices.Length;
|
|
public void Init(EEventPartnerStatueDiceFace face, int idx)
|
|
{
|
|
foreach (var dice in dices)
|
|
dice.gameObject.SetActive(false);
|
|
diceInto.gameObject.SetActive(true);
|
|
diceInto.SetDiceFace(face);
|
|
// for (int i = 1; i < dices.Length; i++)
|
|
// dices[i].gameObject.SetActive(false);
|
|
}
|
|
|
|
public async System.Threading.Tasks.Task PlayAsync(EEventPartnerStatueDiceFace face, int idx)
|
|
{
|
|
// var idx = UnityEngine.Random.Range(0, dices.Length);
|
|
diceInto.gameObject.SetActive(false);
|
|
for (int i = 0; i < dices.Length; i++)
|
|
dices[i].gameObject.SetActive(false);
|
|
|
|
dices[idx].gameObject.SetActive(true);
|
|
await dices[idx].Play(face);
|
|
}
|
|
|
|
public async void Play(EEventPartnerStatueDiceFace face, int idx)
|
|
{
|
|
try
|
|
{
|
|
await PlayAsync(face, idx);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
Debug.LogError(e);
|
|
}
|
|
}
|
|
|
|
public void Hide()
|
|
{
|
|
foreach (var dice in dices)
|
|
dice.Hide();
|
|
diceInto.Hide();
|
|
}
|
|
}
|