From 39001a600fcae2bcf27c225df8752d75fb92fef4 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期五, 31 十月 2025 11:18:26 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.1.20:10010/r/Project_SG_scripts
---
Main/Component/UI/Decorate/PingPong/PingPongMove.cs | 76 ++++++++++++++++++-------------------
1 files changed, 37 insertions(+), 39 deletions(-)
diff --git a/Main/Component/UI/Decorate/PingPong/PingPongMove.cs b/Main/Component/UI/Decorate/PingPong/PingPongMove.cs
index 024af32..b93dba9 100644
--- a/Main/Component/UI/Decorate/PingPong/PingPongMove.cs
+++ b/Main/Component/UI/Decorate/PingPong/PingPongMove.cs
@@ -1,47 +1,45 @@
锘縰sing UnityEngine;
using System.Collections;
-namespace vnxbqy.UI {
- public class PingPongMove:MonoBehaviour {
+public class PingPongMove:MonoBehaviour {
- public Transform reference;
- public Vector3 amplitue;
- public float speed;
+ public Transform reference;
+ public Vector3 amplitue;
+ public float speed;
- Vector3 referencePos = Vector3.zero;
+ Vector3 referencePos = Vector3.zero;
- void OnEnable() {
- referencePos = reference == null ? this.transform.localPosition : reference.localPosition;
- }
-
- float x = 0f;
- float y = 0f;
- float z = 0f;
- void LateUpdate() {
-
- if(Mathf.Abs(amplitue.x) > 0.001f) {
- x = referencePos.x - amplitue.x * 0.5f + Mathf.PingPong(Time.time * speed,amplitue.x);
- }
- else {
- x = referencePos.x;
- }
-
- if(Mathf.Abs(amplitue.y) > 0.001f) {
- y = referencePos.y - amplitue.y * 0.5f + Mathf.PingPong(Time.time * speed,amplitue.y);
- }
- else {
- y = referencePos.y;
- }
-
- if(Mathf.Abs(amplitue.z) > 0.001f) {
- z = referencePos.z - amplitue.z * 0.5f + Mathf.PingPong(Time.time * speed,amplitue.z);
- }
- else {
- z = referencePos.z;
- }
-
- this.transform.localPosition = new Vector3(x,y,z);
- }
-
+ void OnEnable() {
+ referencePos = reference == null ? this.transform.localPosition : reference.localPosition;
}
+
+ float x = 0f;
+ float y = 0f;
+ float z = 0f;
+ void LateUpdate() {
+
+ if(Mathf.Abs(amplitue.x) > 0.001f) {
+ x = referencePos.x - amplitue.x * 0.5f + Mathf.PingPong(Time.time * speed,amplitue.x);
+ }
+ else {
+ x = referencePos.x;
+ }
+
+ if(Mathf.Abs(amplitue.y) > 0.001f) {
+ y = referencePos.y - amplitue.y * 0.5f + Mathf.PingPong(Time.time * speed,amplitue.y);
+ }
+ else {
+ y = referencePos.y;
+ }
+
+ if(Mathf.Abs(amplitue.z) > 0.001f) {
+ z = referencePos.z - amplitue.z * 0.5f + Mathf.PingPong(Time.time * speed,amplitue.z);
+ }
+ else {
+ z = referencePos.z;
+ }
+
+ this.transform.localPosition = new Vector3(x,y,z);
+ }
+
}
--
Gitblit v1.8.0