void ManageEnemies(Mask newMask) { string tag1 = ""; string tag2 = ""; switch (newMask) { case Mask.Red: tag2 = "BlueMon"; tag1 = "RedMon"; playerMask.GetComponent <SpriteRenderer>().color = Color.red; music.PlayRed(); break; case Mask.Blue: tag2 = "RedMon"; tag1 = "BlueMon"; playerMask.GetComponent <SpriteRenderer>().color = Color.blue; music.PlayBlue(); break; case Mask.Green: tag2 = "OrangeMon"; tag1 = "GreenMon"; playerMask.GetComponent <SpriteRenderer>().color = Color.green; music.PlayGreen(); break; case Mask.Orange: tag2 = "GreenMon"; tag1 = "OrangeMon"; playerMask.GetComponent <SpriteRenderer>().color = new Color(255, 174, 0); music.PlayOrange(); break; } ; foreach (GameObject enemy in enemies) { enemy.collider2D.enabled = false; enemy.GetComponent <EnemyScript>().ChangeState(0); if (enemy.tag == tag1) { enemy.collider2D.enabled = true; enemy.GetComponent <EnemyScript>().ChangeState(1); } else if (enemy.tag == tag2) { enemy.collider2D.enabled = true; enemy.GetComponent <EnemyScript>().ChangeState(2); } } }
// Use this for initialization void Start() { int song = Random.Range(0, 4); if (song == 0) { music.PlayRed(); } else if (song == 1) { music.PlayBlue(); } else if (song == 2) { music.PlayGreen(); } else { music.PlayOrange(); } }