- Create the emitter class:
using UnityEngine; using System.Collections; using System.Collections.Generic; public class EmitterGraph : MonoBehaviour { // next steps }
- Declare the member variables:
public int soundIntensity; public Graph soundGraph; public GameObject emitterObj;
- Implement the validation of the emitter object's reference:
public void Start() { if (emitterObj == null) emitterObj = gameObject; }
- Declare the function for emitting sounds:
public int[] Emit() { // next steps }
- Declare and assign the variables needed:
List<int> nodeIds = new List<int>(); Queue<int> queue = new Queue<int>(); List<int> neighbours; int intensity = soundIntensity; int src = soundGraph.GetNearestVertex(emitterObj);
- Add the ...