public List <string> BuildWorld(Transform cameraPivot, VoxelArray voxelArray, bool editor) { var warnings = ReadWorldFile.Read(Resources.Load <TextAsset>("Templates/indoor"), cameraPivot, voxelArray, editor); foreach (var obj in voxelArray.IterateObjects()) { if (obj is PlayerObject) { var behavior = new SoundBehavior(); behavior.SetProperty("dat", data); obj.behaviors.Add(behavior); break; } } return(warnings); }
void Awake() { /* * this is the standard way of setting up a singleton * it will make sure there is only one of these objects and that it exists between scene loads */ if (me == null) { DontDestroyOnLoad(this); me = this; } else { Destroy(this.gameObject); } audioSources = new AudioSource[64]; // populating the array with audiosources by instantiating our audiosource prefab for (int i = 0; i < audioSources.Length; i++) { audioSources[i] = (Instantiate(audioSourcePrefab) as GameObject).GetComponent <AudioSource>(); audioSources[i].transform.SetParent(transform); } }
public void SetSoundBehavior(SoundBehavior sb) { soundBehavior = sb; }