This commit is contained in:
Malak
2026-06-06 16:41:34 +02:00
8 changed files with 335 additions and 7 deletions
+3 -1
View File
@@ -1,6 +1,7 @@
using System;
using UnityEngine;
using Object = System.Object;
using UnityEngine.SceneManagement;
public class DamageHandler : MonoBehaviour
{
@@ -69,6 +70,7 @@ public class DamageHandler : MonoBehaviour
public void Die()
{
Destroy(gameObject);
SceneManager.LoadScene(3, LoadSceneMode.Single);
Destroy(gameObject);
}
}
+11 -6
View File
@@ -94,9 +94,18 @@ public class DropletMovement : MonoBehaviour
if (isDashing || isDropping)
{
return;
}
} // was here before
rb.linearVelocity = new Vector2(movement.x * moveSpeed, rb.linearVelocity.y);
float windForce = 0f;
if (WindManager.Instance != null)
{
windForce = WindManager.Instance.CurrentWindForce;
}
rb.linearVelocity = new Vector2(movement.x * moveSpeed + windForce, rb.linearVelocity.y);
//used to be rb.linearVelocity = new Vector2(movement.x * moveSpeed, rb.linearVelocity.y);
}
private void OnTriggerEnter2D(Collider2D other)
@@ -147,10 +156,6 @@ public class DropletMovement : MonoBehaviour
isGrounded = true;
}
private void OnCollisionExit2D(Collision2D col)
{
isGrounded = false;
}
private void DropDown()
{
+47
View File
@@ -0,0 +1,47 @@
using UnityEngine;
using System.Collections;
public class WindManager : MonoBehaviour
{
public static WindManager Instance;
public float windStrength = 5f;
public float windDuration = 10f;
public float minTimeBetweenWind = 5f;
public float maxTimeBetweenWind = 20f;
public float CurrentWindForce { get; private set; }
void Awake()
{
Instance = this;
}
void Start()
{
StartCoroutine(WindRoutine());
}
IEnumerator WindRoutine()
{
while (true)
{
float waitTime = Random.Range(
minTimeBetweenWind,
maxTimeBetweenWind
);
yield return new WaitForSeconds(waitTime);
CurrentWindForce =
Random.value < 0.5f
? -windStrength
: windStrength;
yield return new WaitForSeconds(windDuration);
CurrentWindForce = 0f;
}
}
}
+2
View File
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 77a372e261eab9a4b9b6cf05e6c6e576