63 lines
3.1 KiB
C#
63 lines
3.1 KiB
C#
using UnityEngine;
|
|
|
|
public class EventPartnerStatueToolAnimationAnchor : MonoBehaviour
|
|
{
|
|
[SerializeField] private Transform Left, Middle, Right;
|
|
|
|
public async System.Threading.Tasks.Task PlayAsync(EventPartnerStatueBuildToolView[] aniPrefabs, float[] aniDelay, float[] fxDelay)
|
|
{
|
|
if (aniPrefabs.Length != 3)
|
|
{
|
|
Debug.LogError("EventPartnerStatueToolAnimationAnchor: aniPrefabs.Length != 3");
|
|
return;
|
|
}
|
|
await PlayAsync(aniPrefabs[0], aniPrefabs[1], aniPrefabs[2], aniDelay, fxDelay);
|
|
// var aniLeftInstance = Instantiate(aniPrefabs[0].gameObject, Vector3.zero, Quaternion.identity, Left);
|
|
// var aniMiddleInstance = Instantiate(aniPrefabs[1].gameObject, Vector3.zero, Quaternion.identity, Middle);
|
|
// var aniRightInstance = Instantiate(aniPrefabs[2].gameObject, Vector3.zero, Quaternion.identity, Right);
|
|
// aniLeftInstance.GetComponent<Animation>().Play();
|
|
// aniMiddleInstance.GetComponent<Animation>().Play();
|
|
// aniRightInstance.GetComponent<Animation>().Play();
|
|
// await System.Threading.Tasks.Task.Delay(System.TimeSpan.FromSeconds(5));
|
|
// if (aniLeftInstance != null)
|
|
// Destroy(aniLeftInstance);
|
|
// if (aniMiddleInstance != null)
|
|
// Destroy(aniMiddleInstance);
|
|
// if (aniRightInstance != null)
|
|
// Destroy(aniRightInstance);
|
|
}
|
|
|
|
public async System.Threading.Tasks.Task PlayAsync(EventPartnerStatueBuildToolView aniLeft, EventPartnerStatueBuildToolView aniMiddle, EventPartnerStatueBuildToolView aniRight, float[] aniDelay, float[] fxDelay)
|
|
{
|
|
var aniLeftInstance = Instantiate(aniLeft.gameObject, Left);
|
|
var aniMiddleInstance = Instantiate(aniMiddle.gameObject, Middle);
|
|
var aniRightInstance = Instantiate(aniRight.gameObject, Right);
|
|
aniLeftInstance.transform.SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity);
|
|
aniMiddleInstance.transform.SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity);
|
|
aniRightInstance.transform.SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity);
|
|
aniMiddleInstance.SetActive(true);
|
|
aniMiddleInstance.GetComponent<EventPartnerStatueBuildToolView>().Play(fxDelay[1]);
|
|
await System.Threading.Tasks.Task.Delay(System.TimeSpan.FromSeconds(aniDelay[1]));
|
|
aniLeftInstance.SetActive(true);
|
|
aniLeftInstance.GetComponent<EventPartnerStatueBuildToolView>().Play(fxDelay[0]);
|
|
await System.Threading.Tasks.Task.Delay(System.TimeSpan.FromSeconds(aniDelay[0]));
|
|
aniRightInstance.SetActive(true);
|
|
aniRightInstance.GetComponent<EventPartnerStatueBuildToolView>().Play(fxDelay[2]);
|
|
await System.Threading.Tasks.Task.Delay(System.TimeSpan.FromSeconds(5));
|
|
if (aniLeftInstance != null)
|
|
Destroy(aniLeftInstance);
|
|
if (aniMiddleInstance != null)
|
|
Destroy(aniMiddleInstance);
|
|
if (aniRightInstance != null)
|
|
Destroy(aniRightInstance);
|
|
}
|
|
|
|
|
|
private void Reset()
|
|
{
|
|
Left = transform.Find("L");
|
|
Middle = transform.Find("M");
|
|
Right = transform.Find("R");
|
|
}
|
|
}
|