public void Attack() { if (Energy == 10) { ChidoriAttack(); SoundEffect.ChidoriVoice(); string[] OtherPlayer = gameManager.OtherPlayer(name); GameObject Opposite; for (int i = 0; i < 3; i++) { Opposite = GameObject.Find(OtherPlayer[i]); for (int j = 0; j < 2; j++) { Opposite.GetComponent <Player>().DrawCard(); } } Energy = 0; JustAttack = true; } else { GameObject Rasengan = Instantiate(Resources.Load <GameObject>("Prefabs/rasengan")); StartCoroutine(RasenganAttack()); SoundEffect.RasenganVoice(); string Opposite_Name = gameManager.Name_to_opposite(name); GameObject Opposite = GameObject.Find(Opposite_Name); Opposite.GetComponent <Player>().DrawCard(); Energy = Energy - 5; JustAttack = true; } var children = this.GetComponentsInChildren <Transform>(); string EnergyName = Energy.ToString(); children[2].GetComponent <SpriteRenderer>().sprite = Resources.Load <Sprite>("graphic/energy" + EnergyName); }
public void SampleTest() { Assert.AreEqual(true, Opposite.IsOpposite("ab", "AB"), "ab, AB => true"); Assert.AreEqual(true, Opposite.IsOpposite("aB", "Ab"), "aB, Ab => true"); Assert.AreEqual(true, Opposite.IsOpposite("aBcd", "AbCD"), "aBcd, AbCD => true"); Assert.AreEqual(false, Opposite.IsOpposite("aBcde", "AbCD"), "aBcde, AbCD => false"); Assert.AreEqual(false, Opposite.IsOpposite("AB", "Ab"), "AB, Ab => false"); Assert.AreEqual(false, Opposite.IsOpposite("", ""), "String.Empty, String.Empty => false"); }
public bool IsValid() { if (Home == null || Opposite == null) { return(false); } if (HomeGoals < 0 || OppositeGoals < 0) { return(false); } if (!Home.IsValid()) { return(false); } if (!Opposite.IsValid()) { return(false); } return(true); }