Quantcast
Viewing all articles
Browse latest Browse all 1488

spawn enemies depending on Audio bursts

I'm Trying to create a spawn system were enemies spawn depending on the music bursts. for example when a soft music is playing enemies spawn slowly and when a action part comes up enemies stars to spawn faster. I'm really not good with Audio stuff so i just have this really general code where I'm trying to understand how it exactly works Thanks in advance using UnityEngine; using System.Collections; public class AudioVisualiser : MonoBehaviour { private float[] m_spectrumData; private int m_bufferSize = 1024; // used for color animation public Gradient g_gradient; // Use this for initialization void Start () { m_spectrumData = new float[m_bufferSize]; } // Update is called once per frame void Update () { GetComponent().GetOutputData ( m_spectrumData , 0 ); for ( int i = 0 ; i < m_bufferSize; i++) { float x = i * 0.2f; float y = m_spectrumData[i] * 10.0f; Debug.DrawLine (new Vector3 ( x ,0,0), new Vector3 (x,y , 0), g_gradient.Evaluate((float)i/m_bufferSize)); } } }

Viewing all articles
Browse latest Browse all 1488

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>