public void Load() { if (container == null) { container = new GameObject("GameObjectPool"); container.hideFlags = HideFlags.NotEditable; GameObject.DontDestroyOnLoad(container); } }
static public void setup(LoadAudio sfx) { if (init) { return; } init = true; globalTargetObject = new GO(); globalTargetObject.name = "Global Audio Player"; globalTargetObject.AddComponent <UnityEngine.AudioListener>(); globalTargetObject.AddComponent <AudioSourcePosition>(); GO.DontDestroyOnLoad(globalTargetObject); globalTarget = globalTargetObject.transform; /* Load every sound, sequentially */ moveMenu = new SoundClip(sfx.moveMenu); enterMenu = new SoundClip(sfx.enterMenu); cancelMenu = new SoundClip(sfx.cancelMenu); pushBlock = new SoundClip(sfx.pushBlock); longPushBlock = new SoundClip(sfx.longPushBlock); blockLand = new SoundClip(sfx.blockLand); blockShake = new SoundClip(sfx.blockShake); playerTurning = new SoundClip(sfx.playerTurning); playerMoving = new SoundClip(sfx.playerMoving); playerClimbBlock = new SoundClip(sfx.playerClimbBlock); playerWalkDownBlock = new SoundClip(sfx.playerWalkDownBlock); playerLand = new SoundClip(sfx.playerLand); playerDeath = new SoundClip(sfx.playerDeath); playerFalling = new SoundClip(sfx.playerFalling); playerMoveLedge = new SoundClip(sfx.playerMoveLedge); playerCantPush = new SoundClip(sfx.playerCantPush); crackedBlockCrack = new SoundClip(sfx.crackedBlockCrack); crackedBlockBreak = new SoundClip(sfx.crackedBlockBreak); checkpoint = new SoundClip(sfx.checkpoint); victoryStart = new SoundClip(sfx.victoryStart); victory = new SoundClip(sfx.victory); defeatStart = new SoundClip(sfx.defeatStart); defeat = new SoundClip(sfx.defeat); }