Merge branch 'main' of https://github.com/orsolya-st/gamejam_050626
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 77a372e261eab9a4b9b6cf05e6c6e576
|
||||
Reference in New Issue
Block a user