| | |
| | | using System; |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using Unity.VisualScripting; |
| | | using UnityEngine; |
| | | using UnityEngine.Animations; |
| | | |
| | |
| | | { |
| | | t += Speed * Time.deltaTime; |
| | | |
| | | if (isEnd) |
| | | if(isFixed) |
| | | { |
| | | // 초기 좌표까지 애니메이션 |
| | | transform.localPosition = Vector3.Lerp(transform.localPosition, initPos, t); |
| | | if (transform.localPosition == initPos) |
| | | if (isEnd) |
| | | { |
| | | InitValues(false); |
| | | // 초기 좌표까지 애니메이션 |
| | | transform.localPosition = Vector3.Lerp(transform.localPosition, initPos, t); |
| | | if (transform.localPosition == initPos) |
| | | { |
| | | InitValues(false); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | else |
| | | { |
| | | // 목표 좌표까지 애니메이션 |
| | | transform.localPosition = Vector3.Lerp(transform.localPosition, targetPos, t); |
| | | if (transform.localPosition == targetPos) |
| | | { |
| | | InitValues(true); |
| | | } |
| | | } |
| | | } else |
| | | { |
| | | // 목표 좌표까지 애니메이션 |
| | | transform.localPosition = Vector3.Lerp(transform.localPosition, targetPos, t); |
| | | if (transform.localPosition == targetPos) |
| | | if (isEnd) |
| | | { |
| | | InitValues(true); |
| | | // 초기 좌표까지 애니메이션 |
| | | 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; |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | } |
| | | } |