Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8,615 changes: 8,615 additions & 0 deletions Assets/Scenes/rhthymTest.unity

Large diffs are not rendered by default.

114 changes: 0 additions & 114 deletions Assets/objects/env_ground.png.meta

This file was deleted.

62 changes: 62 additions & 0 deletions Assets/scripts/FunctionTimer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class FunctionTimer
{
public static FunctionTimer Create(Action action, float functionTime)
{
GameObject gameObj = new GameObject("FunctionTimer", typeof(MonoBehaviourHook));

FunctionTimer timer = new FunctionTimer(action, functionTime, gameObj);

gameObj.GetComponent<MonoBehaviourHook>().onUpdate = timer.Update;
return timer;
}

public class MonoBehaviourHook : MonoBehaviour
{
public Action onUpdate;

private void Update()
{
if (onUpdate != null)
{
onUpdate();
}
}
}
private Action action;
private float time;
private GameObject gameObj;
private bool isDestroy;

// Start is called before the first frame update
private FunctionTimer(Action action, float time, GameObject gameObj)
{
this.action = action;
this.time = time;
this.gameObj = gameObj;
isDestroy = false;
}

public void Update()
{
if (!isDestroy) {
time -= Time.deltaTime;

if (time < 0)
{
action();
DestroySelf();
}
}
}

private void DestroySelf()
{
isDestroy = true;
UnityEngine.Object.Destroy(gameObj);
}
}
46 changes: 46 additions & 0 deletions Assets/scripts/NoteObject.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class NoteObject : MonoBehaviour
{
public bool validHit;
public KeyCode key;
// Start is called before the first frame update
void Start()
{

}

// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(key))
{
if (validHit)
{
//gameObject.SetActive(false);
Destroy(gameObject);
}
}
}

private void OnTriggerEnter2D(Collider2D other)
{
if(other.tag == "Activator")
{
validHit = true;
}
}
private void OnTriggerExit2D(Collider2D other)
{
if (other.tag == "Activator")
{
validHit = false;
}
}
private void OnBecameInvisible()
{
Destroy(gameObject);
}
}
108 changes: 54 additions & 54 deletions Assets/scripts/beatManager.cs
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class BeatManager : MonoBehaviour
{
public AudioSource normal;
public AudioSource heightened;
private bool isHeightened = false;
private float fadeDuration = 1.5f;

// Start is called before the first frame update
void Start()
{
normal.Play();
heightened.volume = 0;
heightened.Play();
}

public void triggerHeightened() {
if(!isHeightened) {
isHeightened = true;
StartCoroutine(FadeHeartbeats(normal, heightened));
}
}

public void resetNormal() {
if(isHeightened) {
isHeightened = false;
StartCoroutine(FadeHeartbeats(heightened, normal));
}
}

private IEnumerator FadeHeartbeats(AudioSource fadeOut, AudioSource fadeIn) {
float startVol = fadeOut.volume;
fadeIn.volume = 0;
float timer = 0f;
while(timer < fadeDuration) {
timer += Time.deltaTime;
fadeOut.volume = Mathf.Lerp(startVol, 0, timer / fadeDuration);
fadeIn.volume = Mathf.Lerp(0, startVol, timer / fadeDuration);
yield return null;
}

fadeOut.volume = 0;
fadeIn.volume = startVol;
}

// Update is called once per frame
void Update()
{

}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BeatManager : MonoBehaviour
{
public AudioSource normal;
public AudioSource heightened;
private bool isHeightened = false;
private float fadeDuration = 1.5f;
// Start is called before the first frame update
void Start()
{
normal.Play();
heightened.volume = 0;
heightened.Play();
}
public void triggerHeightened() {
if(!isHeightened) {
isHeightened = true;
StartCoroutine(FadeHeartbeats(normal, heightened));
}
}
public void resetNormal() {
if(isHeightened) {
isHeightened = false;
StartCoroutine(FadeHeartbeats(heightened, normal));
}
}
private IEnumerator FadeHeartbeats(AudioSource fadeOut, AudioSource fadeIn) {
float startVol = fadeOut.volume;
fadeIn.volume = 0;
float timer = 0f;
while(timer < fadeDuration) {
timer += Time.deltaTime;
fadeOut.volume = Mathf.Lerp(startVol, 0, timer / fadeDuration);
fadeIn.volume = Mathf.Lerp(0, startVol, timer / fadeDuration);
yield return null;
}
fadeOut.volume = 0;
fadeIn.volume = startVol;
}
// Update is called once per frame
void Update()
{
}
}
29 changes: 29 additions & 0 deletions Assets/scripts/beatScroller.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class beatScroller : MonoBehaviour
{
public float beatTempo;
public bool started;
// Start is called before the first frame update
void Start()
{
beatTempo = beatTempo / 60f;
}

// Update is called once per frame
void Update()
{
if (!started)
{
/*if (Input.anyKeyDown){
started = true;
}*/
}
else
{
transform.position -= new Vector3(0f, beatTempo * Time.deltaTime, 0f);
}
}
}
Loading