private CityWeakness ChooseType() { CityWeakness TmpType = CityWeakness.EARTHQUAKE; int index = Random.Range(3, 6); switch (index) { case 3: TmpType = CityWeakness.EARTHQUAKE; dmgDealer.damageType = DamageKinds[3]; break; case 4: TmpType = CityWeakness.LIGHTNING; dmgDealer.damageType = DamageKinds[4]; break; case 5: TmpType = CityWeakness.TORNADO; dmgDealer.damageType = DamageKinds[5]; break; } Weaknesstimer = Time.time + Random.Range(minWeaknessTime, maxWeaknessTime); return(TmpType); }
private void SwitchState() { if (Alive.gameObject.activeSelf == true) { Alive.gameObject.SetActive(false); Dead.gameObject.SetActive(true); transform.GetChild(2).localScale = new Vector3(0.7f, 0.7f); transform.GetChild(2).GetComponent <Animator>().SetBool("Dead", true); CityAnimator.SetBool("Upgrade1", false); CityAnimator.SetBool("Upgrade1", false); } else { transform.GetChild(2).GetComponent <Animator>().SetBool("Dead", false); transform.GetChild(2).localScale = new Vector3(0.27f, 0.27f); Alive.gameObject.SetActive(true); Dead.gameObject.SetActive(false); CurrentWeakness = ChooseType(); citySoundPlayer.clip = citySoundClips[0]; citySoundPlayer.Play(); } }