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); } } }