열차 목업의 내부 확인용 프로젝트
smchoi
2024-07-24 ec231f4110c782d44ea2820a1eaaa7a5711c6f16
Assets/Korail/Scripts/Action/ActionButton.cs
@@ -54,8 +54,6 @@
            targetPos = TargetRot;
            initPos = transform.localPosition;
        
        Initialize();
    }
@@ -72,35 +70,15 @@
    }
    void EndInit()
    {
        if (!isFixed)
        {
            transform.localRotation = targetRot;
        }
        else
        {
            transform.localPosition = targetPos;
        }
        isEnd = true;
    }
    void Init()
    {
        if (!isFixed)
        {
            transform.localRotation = initRot;
        }
        else
        {
            transform.localPosition = initPos;
        }
        isEnd = false;
    }
@@ -128,30 +106,7 @@
        if (Run)
        {
            t += Speed * Time.deltaTime;
            if (!isFixed)
            {
                if (isEnd)
                {
                    // 초기 회전값까지 애니메이션
                    transform.localRotation = Quaternion.Slerp(transform.localRotation, initRot, t);
                    if (transform.localRotation == initRot)
                    {
                        InitValues(false);
                    }
                }
                else
                {
                    // 목표 회전값까지 애니메이션
                    transform.localRotation = Quaternion.Slerp(transform.localRotation, targetRot, t);
                    if (transform.localRotation == targetRot)
                    {
                        InitValues(true);
                    }
                }
            }
            else
            {
                if (isEnd)
                {
                    // 초기 좌표까지 애니메이션
@@ -170,7 +125,7 @@
                        InitValues(true);
                    }
                }
            }
        }
    }
}