ハートアニメーションcallback対応
This commit is contained in:
parent
803cc79ba0
commit
5e3a864fcf
|
|
@ -1,3 +1,4 @@
|
||||||
|
using System;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
public class HeartAnimation : MonoBehaviour
|
public class HeartAnimation : MonoBehaviour
|
||||||
|
|
@ -8,8 +9,7 @@ public class HeartAnimation : MonoBehaviour
|
||||||
private float animationDelay = .3f;
|
private float animationDelay = .3f;
|
||||||
private float animationDuration = .8f;
|
private float animationDuration = .8f;
|
||||||
private float heartToMeterDuration = .5f;
|
private float heartToMeterDuration = .5f;
|
||||||
private float destroyDeley = 2f;
|
public void GetHeart(Action callback = null)
|
||||||
public void GetHeart()
|
|
||||||
{
|
{
|
||||||
smallHeart.SetActive(false);
|
smallHeart.SetActive(false);
|
||||||
this.CallWaitForSeconds(animationDelay, () =>
|
this.CallWaitForSeconds(animationDelay, () =>
|
||||||
|
|
@ -26,7 +26,11 @@ public class HeartAnimation : MonoBehaviour
|
||||||
}, () =>
|
}, () =>
|
||||||
{
|
{
|
||||||
smallHeart.SetActive(true);
|
smallHeart.SetActive(true);
|
||||||
Destroy(bigHeart, destroyDeley);
|
this.CallWaitForSeconds(1f, () =>
|
||||||
|
{
|
||||||
|
callback?.Invoke();
|
||||||
|
Destroy(bigHeart, 1f);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue