From e9ea621b93fbb58d9edfca8375918791637bbd52 Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 30 Dec 2020 20:59:04 +0800 Subject: +init --- Client/Assembly-CSharp/ChainBehaviour.cs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Client/Assembly-CSharp/ChainBehaviour.cs (limited to 'Client/Assembly-CSharp/ChainBehaviour.cs') diff --git a/Client/Assembly-CSharp/ChainBehaviour.cs b/Client/Assembly-CSharp/ChainBehaviour.cs new file mode 100644 index 0000000..38a5da5 --- /dev/null +++ b/Client/Assembly-CSharp/ChainBehaviour.cs @@ -0,0 +1,27 @@ +using System; +using UnityEngine; + +public class ChainBehaviour : MonoBehaviour +{ + public FloatRange SwingRange = new FloatRange(0f, 30f); + + public float SwingPeriod = 2f; + + public float swingTime; + + private Vector3 vec; + + public void Awake() + { + this.swingTime = FloatRange.Next(0f, this.SwingPeriod); + this.vec.z = this.SwingRange.Lerp(Mathf.Sin(this.swingTime)); + base.transform.eulerAngles = this.vec; + } + + public void Update() + { + this.swingTime += Time.deltaTime / this.SwingPeriod; + this.vec.z = this.SwingRange.Lerp(Mathf.Sin(this.swingTime * 3.1415927f) / 2f + 0.5f); + base.transform.eulerAngles = this.vec; + } +} -- cgit v1.1-26-g67d0