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