diff options
Diffstat (limited to 'Client/Assembly-CSharp/LeafBehaviour.cs')
-rw-r--r-- | Client/Assembly-CSharp/LeafBehaviour.cs | 40 |
1 files changed, 40 insertions, 0 deletions
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<Sprite> ImageFiller = new RandomFill<Sprite>(); + + [HideInInspector] + public Rigidbody2D body; + + public void Start() + { + LeafBehaviour.ImageFiller.Set(this.Images); + base.GetComponent<SpriteRenderer>().sprite = LeafBehaviour.ImageFiller.Get(); + this.body = base.GetComponent<Rigidbody2D>(); + 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); + } + } +} |