This commit is contained in:
cemt1363
2026-06-06 02:46:14 +02:00
+7 -4
View File
@@ -8,6 +8,7 @@ public class DropletMovement : MonoBehaviour
// helper variables // helper variables
private bool isGrounded = true; private bool isGrounded = true;
private float facingDirection = 1f; private float facingDirection = 1f;
private bool isDropping = false;
// movement // movement
private Vector2 movement; private Vector2 movement;
@@ -62,10 +63,10 @@ public class DropletMovement : MonoBehaviour
private void FixedUpdate() private void FixedUpdate()
{ {
if (isDashing) if (isDashing || isDropping)
{ {
return; return;
} }
rb.linearVelocity = new Vector2(movement.x * moveSpeed, rb.linearVelocity.y); rb.linearVelocity = new Vector2(movement.x * moveSpeed, rb.linearVelocity.y);
} }
@@ -138,6 +139,7 @@ public class DropletMovement : MonoBehaviour
while (elapsed < duration) while (elapsed < duration)
{ {
isDropping = true;
rb.gravityScale = 0; rb.gravityScale = 0;
transform.Translate(Vector3.down * speed * Time.deltaTime); transform.Translate(Vector3.down * speed * Time.deltaTime);
elapsed += Time.deltaTime; //update time elapsed += Time.deltaTime; //update time
@@ -147,6 +149,7 @@ public class DropletMovement : MonoBehaviour
//enable collider --> not a trigger anymore //enable collider --> not a trigger anymore
rb.gravityScale = 1; rb.gravityScale = 1;
playerCollider.isTrigger = false; playerCollider.isTrigger = false;
isDropping = false;
} }
} }