void Start() { if (EnemyDataManager.control.getChosenEnemies().Count <= enemyIndex) { gameObject.SetActive(false); } else { if (enemyData == null) { enemyData = EnemyDataManager.control.getChosenEnemies() [enemyIndex]; enemyType = enemyData.code; useSparkles = enemyData.useSparkles; //animator.runtimeAnimatorController = enemyData.animator.runtimeAnimatorController; spriteSwap.sprites = enemyData.spritesToSwap; //gameObject.SetActive (false); deathAudio = enemyData.deathAudio; enemyData.PrepareSecondaryAction(); if (backgroundObject == null) { backgroundObject = (GameObject)Instantiate(enemyData.background, Vector3.zero, Quaternion.identity); } } } if (jointRbody2d == null) { jointRbody2d = GameObject.FindGameObjectWithTag(Tags.jointObject).GetComponent <Rigidbody2D> (); } joint.connectedBody = jointRbody2d; joint.connectedAnchor = Vector2.zero; spriteSwap.SwapToSprite(0); }
public void PlaySound(AudioNames name) { string filename = GetFileName(name); string clipname = "kidsounds/" + filename; audio.clip = Resources.Load<AudioClip>(clipname); audio.Play(); }
public static string GetFileName(AudioNames audioname) { int num = (int) audioname + 1; if (num >= 6) num++; return string.Format("{0:00}-", num) + audioname.ToString(); }