private void Awake() { if (instance == null) { instance = this; source = GetComponent <AudioSource>(); DontDestroyOnLoad(gameObject); DontDestroyOnLoad(talkSource); if (LOAD_FROM_FILE == true) { scream = new AudioClip[8]; for (int i = 0; i < 8; i++) { instance.StartCoroutine(LoadFromFileAndPutToArray("Sound/VO/pdb_vo_hurt_v1_0" + (i + 1).ToString() + ".wav", scream, i)); } talk = new AudioClip[6]; for (int i = 0; i < 6; i++) { instance.StartCoroutine(LoadFromFileAndPutToArray("Sound/VO/pdb_vo_talk_v1_0" + (i + 1).ToString() + ".wav", talk, i)); } punchNormal = new AudioClip[5]; for (int i = 0; i < 5; i++) { instance.StartCoroutine(LoadFromFileAndPutToArray("Sound/Gameplay/pdb_punch_norm_0" + (i + 1).ToString() + ".wav", punchNormal, i)); } punchDirect = new AudioClip[5]; for (int i = 0; i < 5; i++) { instance.StartCoroutine(LoadFromFileAndPutToArray("Sound/Gameplay/pdb_punch_direct_hit_0" + (i + 1).ToString() + ".wav", punchDirect, i)); } punchRicochet = new AudioClip[5]; for (int i = 0; i < 5; i++) { instance.StartCoroutine(LoadFromFileAndPutToArray("Sound/Gameplay/pdb_punch_ricochet_0" + (i + 1).ToString() + ".wav", punchRicochet, i)); } flyUp = new AudioClip[5]; for (int i = 0; i < 5; i++) { instance.StartCoroutine(LoadFromFileAndPutToArray("Sound/Gameplay/pdb_flyup_0" + (i + 1).ToString() + ".wav", flyUp, i)); } bounce = new AudioClip[5]; for (int i = 0; i < 5; i++) { instance.StartCoroutine(LoadFromFileAndPutToArray("Sound/Gameplay/pdb_wall_bounce_0" + (i + 1).ToString() + ".wav", bounce, i)); } securityLaugh = new AudioClip[19]; for (int i = 0; i < 8; i++) { instance.StartCoroutine(LoadFromFileAndPutToArray("Sound/VO/pdb_security_guy_vo_0" + (i + 1).ToString() + ".wav", securityLaugh, i)); } for (int i = 9; i < 19; i++) { instance.StartCoroutine(LoadFromFileAndPutToArray("Sound/VO/pdb_security_guy_vo_" + (i + 1).ToString() + ".wav", securityLaugh, i)); } securityFlyUp = new AudioClip[5]; for (int i = 0; i < 5; i++) { instance.StartCoroutine(LoadFromFileAndPutToArray("Sound/Gameplay/pdb_security_flyup_0" + (i + 1).ToString() + ".wav", securityFlyUp, i)); } objectHit = new AudioClip[3]; for (int i = 0; i < 3; i++) { instance.StartCoroutine(LoadFromFileAndPutToArray("Sound/Gameplay/pdb_obj_hit_0" + (i + 1).ToString() + ".wav", objectHit, i)); } breakSound = new AudioClip[2]; instance.StartCoroutine(LoadFromFileAndPutToArray("Sound/Gameplay/pdb_start_break.wav", breakSound, 0)); instance.StartCoroutine(LoadFromFileAndPutToArray("Sound/Gameplay/pdb_start_tree.wav", breakSound, 1)); instance.StartCoroutine(LoadFromFile("Sound/Gameplay/pdb_start_transformation.wav", (x) => transform = x)); instance.StartCoroutine(LoadFromFile("Sound/Gameplay/pdb_start_first_punch.wav", (x) => firstPunch = x)); instance.StartCoroutine(LoadFromFile("Sound/Gameplay/pdb_lose.wav", (x) => fall = x)); instance.StartCoroutine(LoadFromFile("Sound/UI/pdb_ui_select.wav", (x) => click = x)); instance.StartCoroutine(LoadFromFile("Sound/UI/pdb_ui_back.wav", (x) => back = x)); instance.StartCoroutine(LoadFromFile("Sound/UI/pdb_ui_purchase.wav", (x) => buy = x)); instance.StartCoroutine(LoadFromFile("Sound/Gameplay/pdb_obj_drone_collision.wav", (x) => droneCollision = x)); instance.StartCoroutine(LoadFromFile("Sound/Gameplay/pdb_obj_drone_loop.wav", (x) => droneLoop = x)); instance.StartCoroutine(LoadFromFile("Sound/Gameplay/pdb_obj_drone_xplo.wav", (x) => droneExplosion = x)); instance.StartCoroutine(LoadFromFile("Sound/Gameplay/pdb_obj_balloon_xplo.wav", (x) => balloonExplosion = x)); instance.StartCoroutine(LoadFromFile("Sound/Gameplay/pdb_obj_ufo_collision.wav", (x) => ufoCollision = x)); instance.StartCoroutine(LoadFromFile("Sound/Gameplay/pdb_obj_ufo_loop.wav", (x) => ufoLoop = x)); instance.StartCoroutine(LoadFromFile("Sound/Gameplay/pdb_obj_ufo_xplo.wav", (x) => ufoExplosion = x)); } } else { Destroy(gameObject); } }