This commit is contained in:
cemt1363
2026-06-06 16:31:58 +02:00
17 changed files with 206 additions and 121 deletions
+3 -56
View File
@@ -1,5 +1,6 @@
using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement;
public class DropletMovement : MonoBehaviour
{
@@ -10,7 +11,6 @@ public class DropletMovement : MonoBehaviour
private bool isGrounded = true;
private float facingDirection = 1f;
private bool isDropping = false;
// private float fallAngleThreshold = -45f;
private float fallTimer;
private bool isFalling;
public float maxFallTime = 0.5f;
@@ -38,28 +38,6 @@ public class DropletMovement : MonoBehaviour
[System.Obsolete]
void Update()
{
//reset falltimer when start the jump
// if ((Input.GetKeyDown(KeyCode.W) || Input.GetKeyDown(KeyCode.UpArrow)) && isGrounded)
// {
// fallTimer = 0f; //jump resets falltime
// }
//fall damage
// if (isGrounded && fallTimer > 0.6f)
// {
// Destroy(gameObject); //TODO
// }
//handle jump/midair variables
// if (isGrounded)
// {
// isFalling = false;
// }
// else
// {
// HandleMidairLogic();
// }
//dashing
if (isDashing)
@@ -125,44 +103,17 @@ public class DropletMovement : MonoBehaviour
private void OnTriggerEnter2D(Collider2D other)
{
/*if (other.CompareTag("Border"))
{
Destroy(gameObject); //for now it destroys the droplet
Debug.Log("Droplet dropped down, animation, game end!");
}*/
//Hole
if (other.CompareTag("Hole"))
{
SceneManager.LoadScene(2, LoadSceneMode.Single);
Destroy(gameObject);
Debug.Log("Fell in hole!");
}
}
// [System.Obsolete]
// private void HandleMidairLogic()
// {
// if (rb.linearVelocity.y >= 0)
// {
// isFalling = false;
// fallTimer = 0f;
// return;
// }
//
// float movementAngle = Mathf.Atan2(rb.velocity.y, rb.velocity.x) * Mathf.Rad2Deg;
// //Degrees: 0 - right, 90 - up, -90 - down --> downwards is beteen -90 and -180
// //Standard treshhold (degree) = -45 --> between -45 and -135 degrees is falling (instead of jumping)
// bool fallingDown = (movementAngle < fallAngleThreshold && movementAngle > (-180f - fallAngleThreshold));
//
// if (fallingDown || rb.velocity.x == 0)
// {
// isFalling = true;
// fallTimer += Time.deltaTime;
// Debug.Log($"Fall time: {fallTimer:F2} seconds");
// }
// }
private IEnumerator Dash()
{
canDash = false;
@@ -198,10 +149,6 @@ public class DropletMovement : MonoBehaviour
isGrounded = true;
}
private void OnCollisionExit2D(Collision2D col)
{
isGrounded = false;
}
private void DropDown()
{
@@ -232,7 +179,7 @@ public class DropletMovement : MonoBehaviour
//move down the height of the collider
float dropDistance = playerCollider.bounds.size.y;
float speed = dropDistance/duration;
float speed = dropDistance / duration;
while (elapsed < duration)
{
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c75792f2507b4ad4193b0d02e0f844bb
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
-14
View File
@@ -1,14 +0,0 @@
using UnityEngine;
using UnityEngine.SceneManagement;
public class SceneController : MonoBehaviour
{
// Start is called once before the first execution of Update after the MonoBehaviour is created
public int sceneIndex;
private void OggerEnter2D(Collider2D collision)
{
Debug.Log("Hole");
SceneManager.LoadScene(sceneIndex, LoadSceneMode.Single);
}
}
@@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: bbf8ab4673d6bf447aab098a12320431