From 81330a6b68d307937c262368a42a3fa4e9ad4207 Mon Sep 17 00:00:00 2001 From: chai <215380520@qq.com> Date: Thu, 23 May 2024 10:10:23 +0800 Subject: + NavMeshTest --- .../NavMeshTest/Assets/Scripts/Tween/SmoothMove.cs | 21 +++++++++++++++++++++ .../Assets/Scripts/Tween/SmoothMove.cs.meta | 11 +++++++++++ 2 files changed, 32 insertions(+) create mode 100644 Other/NavMeshTest/Assets/Scripts/Tween/SmoothMove.cs create mode 100644 Other/NavMeshTest/Assets/Scripts/Tween/SmoothMove.cs.meta (limited to 'Other/NavMeshTest/Assets/Scripts/Tween') diff --git a/Other/NavMeshTest/Assets/Scripts/Tween/SmoothMove.cs b/Other/NavMeshTest/Assets/Scripts/Tween/SmoothMove.cs new file mode 100644 index 0000000..1ead7ff --- /dev/null +++ b/Other/NavMeshTest/Assets/Scripts/Tween/SmoothMove.cs @@ -0,0 +1,21 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class SmoothMove : MonoBehaviour +{ + public Vector3 from; + public Vector3 to; + + public float speed; + + float time; + + private void Update() + { + time += Time.deltaTime * speed; + + transform.position = Vector3.Lerp(from, to, Mathf.PingPong(time, 10) / 10.0f); + } + +} diff --git a/Other/NavMeshTest/Assets/Scripts/Tween/SmoothMove.cs.meta b/Other/NavMeshTest/Assets/Scripts/Tween/SmoothMove.cs.meta new file mode 100644 index 0000000..7e98d19 --- /dev/null +++ b/Other/NavMeshTest/Assets/Scripts/Tween/SmoothMove.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ff71ad33a52ece64eb93ef7695ba5a8c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: -- cgit v1.1-26-g67d0