コイン吸収時間を設定可能にした
This commit is contained in:
parent
796f6371e1
commit
0215623401
|
|
@ -17,7 +17,8 @@ public class CoinManager : SingletonMonoBehaviour<CoinManager>
|
|||
[SerializeField] private RectTransform coinPrefab;
|
||||
|
||||
// Animation
|
||||
[SerializeField] private float duration = 0.5f;
|
||||
[SerializeField] private float coinUpDuration = 0.5f;
|
||||
[SerializeField] private float coinMoveDuration = 0.5f;
|
||||
|
||||
[SerializeField] private RectTransform rootTransform;
|
||||
private int ownCoin;
|
||||
|
|
@ -39,7 +40,7 @@ public class CoinManager : SingletonMonoBehaviour<CoinManager>
|
|||
ownCoin += count;
|
||||
coinAnimator.SetTrigger(Add);
|
||||
SoundManager.Instance.PlaySE("se_coin_get");
|
||||
coinCountText.CountUpAnimation(coinTextFormat, ownCoin, duration);
|
||||
coinCountText.CountUpAnimation(coinTextFormat, ownCoin, coinUpDuration);
|
||||
}
|
||||
|
||||
public void AddCoinWithEffect(int count, Vector3 pos, Action onComplete = null)
|
||||
|
|
@ -47,7 +48,7 @@ public class CoinManager : SingletonMonoBehaviour<CoinManager>
|
|||
ownCoin += count;
|
||||
InstantiateEffect(coinPrefab, count, pos, coinIconTransform.position, () =>
|
||||
{
|
||||
coinCountText.CountUpAnimation(coinTextFormat, ownCoin, duration);
|
||||
coinCountText.CountUpAnimation(coinTextFormat, ownCoin, coinUpDuration);
|
||||
onComplete?.Invoke();
|
||||
});
|
||||
}
|
||||
|
|
@ -56,7 +57,7 @@ public class CoinManager : SingletonMonoBehaviour<CoinManager>
|
|||
{
|
||||
var coinEffect = Instantiate(prefab, from, Quaternion.identity, rootTransform);
|
||||
var animator = coinEffect.GetComponent<Animator>();
|
||||
this.CallLerp(1f, f =>
|
||||
this.CallLerp(coinMoveDuration, f =>
|
||||
{
|
||||
coinEffect.position = Vector3.Lerp(from, to, f * f);
|
||||
}, () =>
|
||||
|
|
@ -77,7 +78,7 @@ public class CoinManager : SingletonMonoBehaviour<CoinManager>
|
|||
public void SubCoin(int coin){
|
||||
ownCoin -= coin;
|
||||
if(coinCountText.gameObject.activeInHierarchy){
|
||||
coinCountText.CountUpAnimation(coinTextFormat, ownCoin, duration);
|
||||
coinCountText.CountUpAnimation(coinTextFormat, ownCoin, coinUpDuration);
|
||||
}else{
|
||||
coinCountText.ChangeValue(coinTextFormat, ownCoin);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue