Merge branch 'main' of https://github.com/orsolya-st/gamejam_050626
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class AudioManager : MonoBehaviour
|
||||
{
|
||||
[SerializeField] AudioSource musicSource;
|
||||
[SerializeField] AudioSource SFXSource;
|
||||
|
||||
public AudioClip bgm;
|
||||
public AudioClip fallDamage;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
musicSource.clip = bgm;
|
||||
musicSource.Play();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cf3cb896d15dce149a13f70e47c35794
|
||||
@@ -0,0 +1,43 @@
|
||||
using UnityEngine;
|
||||
using Unity.Cinemachine;
|
||||
|
||||
public class DownwardCamera : CinemachineExtension
|
||||
{
|
||||
private float minY;
|
||||
private bool isInitialized = false;
|
||||
|
||||
protected override void PostPipelineStageCallback(
|
||||
CinemachineVirtualCameraBase vcam,
|
||||
CinemachineCore.Stage stage,
|
||||
ref CameraState state,
|
||||
float deltaTime)
|
||||
{
|
||||
if (stage == CinemachineCore.Stage.Body)
|
||||
{
|
||||
Vector3 pos = state.RawPosition;
|
||||
|
||||
if (!isInitialized)
|
||||
{
|
||||
minY = pos.y;
|
||||
isInitialized = true;
|
||||
}
|
||||
|
||||
if (pos.y < minY)
|
||||
{
|
||||
minY = pos.y;
|
||||
}
|
||||
// If it tries to move UP (higher Y), lock it to the lowest point we've reached
|
||||
else
|
||||
{
|
||||
pos.y = minY;
|
||||
}
|
||||
|
||||
state.RawPosition = pos;
|
||||
}
|
||||
}
|
||||
|
||||
public void ResetCamera()
|
||||
{
|
||||
isInitialized = false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f0a87a1c7758eb34587daa15a89d59d4
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
@@ -66,6 +65,7 @@ public class DamageHandler : MonoBehaviour
|
||||
{
|
||||
animator.SetBool("Falling",false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void OnCollisionEnter2D(Collision2D other)
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
using UnityEngine;
|
||||
using TMPro;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class Timer : MonoBehaviour
|
||||
{
|
||||
// By making these public, they will show up in the Unity Inspector
|
||||
public TMP_Text timeText;
|
||||
public float timeRemaining = 89f; // Give it a starting time!
|
||||
|
||||
private bool timerIsRunning = false;
|
||||
|
||||
public GameObject targetObject;
|
||||
|
||||
void Update()
|
||||
{
|
||||
// 1. Wait for input to start
|
||||
// If the timer isn't running yet AND we still have time left...
|
||||
if (!timerIsRunning && timeRemaining > 0)
|
||||
{
|
||||
// Update the display so the player sees the starting time
|
||||
DisplayTime(timeRemaining);
|
||||
|
||||
if (Input.anyKey)
|
||||
{
|
||||
timerIsRunning = true; // Start the clock!
|
||||
}
|
||||
else
|
||||
{
|
||||
return; // Stop the code here until they press a key
|
||||
}
|
||||
}
|
||||
|
||||
// 2. The countdown logic
|
||||
if (timerIsRunning)
|
||||
{
|
||||
if (timeRemaining > 0)
|
||||
{
|
||||
timeRemaining -= Time.deltaTime;
|
||||
DisplayTime(timeRemaining);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Time has run out! Stop the timer so it doesn't go into negative numbers.
|
||||
timeRemaining = 0;
|
||||
timerIsRunning = false;
|
||||
DisplayTime(timeRemaining);
|
||||
Debug.Log("Time's up!");
|
||||
}
|
||||
}
|
||||
|
||||
if (timeRemaining <= 0)
|
||||
{
|
||||
SceneManager.LoadScene(4, LoadSceneMode.Single);
|
||||
Destroy(targetObject);
|
||||
}
|
||||
}
|
||||
|
||||
private void DisplayTime(float timeToDisplay)
|
||||
{
|
||||
timeToDisplay += 1;
|
||||
|
||||
float minutes = Mathf.FloorToInt(timeToDisplay / 60);
|
||||
float seconds = Mathf.FloorToInt(timeToDisplay % 60);
|
||||
|
||||
timeText.text = string.Format("{0:00}:{1:00}", minutes, seconds);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 09abf4d558ce137439bf5eee59bd6c0b
|
||||
@@ -5,6 +5,8 @@ public class WindManager : MonoBehaviour
|
||||
{
|
||||
public static WindManager Instance;
|
||||
|
||||
public GameObject[] windEffects;
|
||||
|
||||
public float windStrength = 5f;
|
||||
public float windDuration = 10f;
|
||||
|
||||
@@ -20,6 +22,11 @@ public class WindManager : MonoBehaviour
|
||||
|
||||
void Start()
|
||||
{
|
||||
foreach (GameObject effect in windEffects)
|
||||
{
|
||||
effect.SetActive(false);
|
||||
}
|
||||
|
||||
StartCoroutine(WindRoutine());
|
||||
}
|
||||
|
||||
@@ -27,21 +34,30 @@ public class WindManager : MonoBehaviour
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
float waitTime = Random.Range(
|
||||
minTimeBetweenWind,
|
||||
maxTimeBetweenWind
|
||||
);
|
||||
|
||||
float waitTime = Random.Range(minTimeBetweenWind, maxTimeBetweenWind);
|
||||
yield return new WaitForSeconds(waitTime);
|
||||
|
||||
CurrentWindForce =
|
||||
Random.value < 0.5f
|
||||
? -windStrength
|
||||
: windStrength;
|
||||
bool windGoesLeft = Random.value < 0.5f;
|
||||
|
||||
CurrentWindForce = windGoesLeft ? -windStrength : windStrength;
|
||||
|
||||
foreach (GameObject effect in windEffects)
|
||||
{
|
||||
effect.transform.localScale = windGoesLeft
|
||||
? new Vector3(1, 1, 1)
|
||||
: new Vector3(-1, 1, 1);
|
||||
|
||||
effect.SetActive(true);
|
||||
}
|
||||
|
||||
yield return new WaitForSeconds(windDuration);
|
||||
|
||||
CurrentWindForce = 0f;
|
||||
|
||||
foreach (GameObject effect in windEffects)
|
||||
{
|
||||
effect.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user