Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
RigidMove.cs
Go to the documentation of this file.
1using UnityEngine;
2
3public class RigidMove : RigidUpdate
4{
5 public float force;
6
7 private bool flip;
8
9 private float time;
10
11 private Vector3 dir = new Vector3(1f, 0f, 0f);
12
13 public override void OnFixedUpdate()
14 {
15 if (!(rb.velocity.y > 0.3f) && !(rb.velocity.y < -0.3f))
16 {
18 dir.x = ((!flip) ? 1 : (-1));
19 rb.transform.position = rb.transform.position + dir * force;
20 if (rb.transform.position.x > RigidUpdate.rightX)
21 {
22 flip = true;
23 }
24 else if (rb.transform.position.x < RigidUpdate.leftX)
25 {
26 flip = false;
27 }
28 }
29 }
30}
override void OnFixedUpdate()
Definition: RigidMove.cs:13
bool flip
Definition: RigidMove.cs:7
Vector3 dir
Definition: RigidMove.cs:11
float time
Definition: RigidMove.cs:9
float force
Definition: RigidMove.cs:5
Rigidbody2D rb
Definition: RigidUpdate.cs:13
static float delta
Definition: RigidUpdate.cs:6
static float leftX
Definition: RigidUpdate.cs:8
static float rightX
Definition: RigidUpdate.cs:10