menus
This commit is contained in:
1 parent
cf55d7034d
commit
4d24939a2b
9 files changed
+5132
-1596
No files matched your search
@@ -0,0 +1,47 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine.VFX;
|
||||
using UnityEngine;
|
||||
|
||||
public class WavzController : MonoBehaviour
|
||||
{
|
||||
|
||||
public float bpm;
|
||||
public float beatsPerBar;
|
||||
public float barsPerPhrase;
|
||||
public float phraseLengthSec;
|
||||
public float min;
|
||||
public float max;
|
||||
|
||||
private VisualEffect vfx;
|
||||
|
||||
void Start() {
|
||||
vfx = gameObject.GetComponent<VisualEffect>();
|
||||
|
||||
min = 0.5f;
|
||||
max = 128f;
|
||||
|
||||
bpm = 120f;
|
||||
// assume 4 beats per bar * 8 bars per phrase
|
||||
beatsPerBar = 4.0f;
|
||||
barsPerPhrase = 8.0f;
|
||||
phraseLengthSec = (bpm / 60.0f) * beatsPerBar * barsPerPhrase;
|
||||
|
||||
Debug.Log($"phrase length in seconds {phraseLengthSec}");
|
||||
}
|
||||
|
||||
void Update() {
|
||||
float x = max * Mathf.Abs(Mathf.Sin(Time.time / phraseLengthSec)) + min;
|
||||
float y = max * Mathf.Abs(Mathf.Sin( Time.time / (phraseLengthSec / 2))) + min;
|
||||
float z = max * Mathf.Abs(Mathf.Sin(Time.time / (phraseLengthSec / 3))) + min;
|
||||
vfx.SetFloat("AttractionSpeed", y);
|
||||
vfx.SetFloat("AttractionForce", y);
|
||||
vfx.SetFloat("StickDistance", z);
|
||||
vfx.SetFloat("StickForce", z);
|
||||
}
|
||||
|
||||
public void SetStickiness(float v) {
|
||||
// vfx.SetFloat("StickDistance", z);
|
||||
// vfx.SetFloat("StickForce", z);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user