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/LeafBehaviour.cs | 40 +++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 Client/Assembly-CSharp/LeafBehaviour.cs (limited to 'Client/Assembly-CSharp/LeafBehaviour.cs') diff --git a/Client/Assembly-CSharp/LeafBehaviour.cs b/Client/Assembly-CSharp/LeafBehaviour.cs new file mode 100644 index 0000000..58e2b0a --- /dev/null +++ b/Client/Assembly-CSharp/LeafBehaviour.cs @@ -0,0 +1,40 @@ +using System; +using UnityEngine; + +public class LeafBehaviour : MonoBehaviour +{ + public Sprite[] Images; + + public FloatRange SpinSpeed = new FloatRange(-45f, 45f); + + public Vector2Range StartVel; + + public float AccelRate = 30f; + + [HideInInspector] + public LeafMinigame Parent; + + public bool Held; + + private static RandomFill ImageFiller = new RandomFill(); + + [HideInInspector] + public Rigidbody2D body; + + public void Start() + { + LeafBehaviour.ImageFiller.Set(this.Images); + base.GetComponent().sprite = LeafBehaviour.ImageFiller.Get(); + this.body = base.GetComponent(); + this.body.angularVelocity = this.SpinSpeed.Next(); + this.body.velocity = this.StartVel.Next(); + } + + public void FixedUpdate() + { + if (!this.Held && (double)base.transform.localPosition.x < -2.5) + { + this.Parent.LeafDone(this); + } + } +} -- cgit v1.1-26-g67d0