blob: 58e2b0a13207a3d7fa7cfc78e4e12268266e54ec (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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);
}
}
}
|