열차 목업의 내부 확인용 프로젝트
smchoi
2024-07-31 9fe33c1ae076b0f6501619388e6b4cc872b76f80
Assets/Korail/Scripts/Action/ActionButton.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.Animations;
@@ -107,6 +108,8 @@
        {
            t += Speed * Time.deltaTime;
            if(isFixed)
            {
            if (isEnd)
            {
                // 초기 좌표까지 애니메이션
@@ -125,6 +128,31 @@
                    InitValues(true);
                }
            }
            } else
            {
                if (isEnd)
                {
                    // 초기 좌표까지 애니메이션
                    transform.localPosition = Vector3.Lerp(transform.localPosition, initPos, t);
                    if (transform.localPosition == initPos)
                    {
                        InitValues(false);
                    }
                }
                else
                {
                    // 목표 좌표까지 애니메이션
                    transform.localPosition = Vector3.Lerp(transform.localPosition, targetPos, t);
                    if (transform.localPosition == targetPos)
                    {
                        isEnd = true;
                        t = 0;
                    }
                }
            }
        }
    }