💾 코드
animator.GetCurrentAnimatorStateInfo(0).IsName("IsSpawning") && animator.GetCurrentAnimatorStateInfo(0).normalizedTime < 1.0f
💾 코드
Vector2 btnDestination = new Vector2(pos.anchoredPosition.x, pos.anchoredPosition.y - 150);
pos.anchoredPosition = Vector2.MoveTowards(pos.anchoredPosition, btnDestination, Time.deltaTime * speed);
📖 참고
참고할 코드 내용
💾 코드
public void ButtonEffect(RectTransform curBtnPos)
{
OnBtn = true;
SetBtns();
usingBtn = curBtnPos.gameObject;
usingBtn.GetComponent<Image>().color = Color.red;
StartCoroutine(moveBtn(backBtnPos, backBtnDestination));
foreach (var pos in btnsPos)
{
if (usingBtn != pos.gameObject)
{
Vector2 btnDestination = new Vector2(pos.anchoredPosition.x, pos.anchoredPosition.y - 150);
StartCoroutine(moveBtn(pos, btnDestination));
}
}
}
private IEnumerator moveBtn(RectTransform movePos, Vector2 desPos)
{
while (Vector2.Distance(movePos.anchoredPosition,desPos) > 20f)
{
movePos.anchoredPosition =
Vector2.Lerp(movePos.anchoredPosition, desPos, speed);
yield return null;
}
if (OnBtn)
{
backBtn.interactable = true;
}
else
{
SetBtns();
}
}