Elin Modding Docs Doc
Loading...
Searching...
No Matches
RigidFloat.cs
1using System;
2using UnityEngine;
3
4// Token: 0x0200051A RID: 1306
5public class RigidFloat : RigidUpdate
6{
7 // Token: 0x06002312 RID: 8978 RVA: 0x000C579E File Offset: 0x000C399E
8 private void Awake()
9 {
10 this._airHeight = this.airHeight + UnityEngine.Random.Range(-2f, 2f);
11 this.time = UnityEngine.Random.Range(0f, this.pingpongTime);
12 }
13
14 // Token: 0x06002313 RID: 8979 RVA: 0x000C57D4 File Offset: 0x000C39D4
15 public override void OnFixedUpdate()
16 {
17 this.time += Time.fixedDeltaTime * this.flip;
18 if (this.time > this.pingpongTime)
19 {
20 this.flip = -1f;
21 this.time = this.pingpongTime;
22 }
23 else if (this.time < 0f)
24 {
25 this.flip = 1f;
26 this.time = 0f;
27 }
28 float num = this.time - this.pingpongTime * 0.5f;
29 if (num > 0f)
30 {
31 num = Mathf.Sqrt(num);
32 }
33 else
34 {
35 num = Mathf.Sqrt(-num) * -1f;
36 }
37 float num2 = this._airHeight + num * this.pingpongPower;
38 float num3 = base.transform.position.y;
39 if (num3 < num2)
40 {
41 if (num3 < 1f)
42 {
43 num3 = 1f;
44 }
45 this.rb.AddForce(new Vector2(0f, this.floatPower * (1f - num3 / num2)));
46 }
47 }
48
49 // Token: 0x04001291 RID: 4753
50 public float airHeight = 3.5f;
51
52 // Token: 0x04001292 RID: 4754
53 public float floatPower = 30f;
54
55 // Token: 0x04001293 RID: 4755
56 public float pingpongTime = 1f;
57
58 // Token: 0x04001294 RID: 4756
59 public float pingpongPower = 0.15f;
60
61 // Token: 0x04001295 RID: 4757
62 private float _airHeight;
63
64 // Token: 0x04001296 RID: 4758
65 private float time;
66
67 // Token: 0x04001297 RID: 4759
68 private float flip = 1f;
69}