ハートアニメーションcallback対応

This commit is contained in:
kimura 2021-08-30 12:00:56 +09:00
parent 803cc79ba0
commit 5e3a864fcf
1 changed files with 7 additions and 3 deletions

View File

@ -1,3 +1,4 @@
using System;
using UnityEngine;
public class HeartAnimation : MonoBehaviour
@ -8,8 +9,7 @@ public class HeartAnimation : MonoBehaviour
private float animationDelay = .3f;
private float animationDuration = .8f;
private float heartToMeterDuration = .5f;
private float destroyDeley = 2f;
public void GetHeart()
public void GetHeart(Action callback = null)
{
smallHeart.SetActive(false);
this.CallWaitForSeconds(animationDelay, () =>
@ -26,7 +26,11 @@ public class HeartAnimation : MonoBehaviour
}, () =>
{
smallHeart.SetActive(true);
Destroy(bigHeart, destroyDeley);
this.CallWaitForSeconds(1f, () =>
{
callback?.Invoke();
Destroy(bigHeart, 1f);
});
});
});
});