public void DeathUpdate(MonsterBody mb) { text.gameObject.SetActive(true); monsters.Remove(mb); text.text = mb.monster_name + " has been eliminated! " + lose_phrases[Random.Range(0, lose_phrases.Count)]; if (monsters.Count == 1) { Win(mb); } else if (monsters.Count == 0) { Draw(); } }
// Start is called before the first frame update void Start() { MonsterBody mb = GetComponent <MonsterBody>(); cost += mb.health; cost += mb.armor; cost += mb.move_speed / 2; cost += GetComponentsInChildren <Gun>().Length *GUN_COST; cost += GetComponentsInChildren <Shield>().Length *SHIELD_COST; cost += GetComponentsInChildren <Sword>().Length *SWORD_COST; if (cost > cost_limit) { print("TOO COSTLY"); Destroy(gameObject); } }
public void Win(MonsterBody mb) { rematch.gameObject.SetActive(true); text.text = mb.monster_name + " wins! " + win_phrases[Random.Range(0, win_phrases.Count)]; }