IEnumerator CheckAttacks() { yield return(new WaitForSeconds(attackCooldown)); // ATAQUES DOS INDIOS for (int a = 0; a < indios.Count; a++) { Indio i = (Indio)indios[a]; for (int b = 0; b < portugueses.Count; b++) { Explorador e = (Explorador)portugueses[b]; if (i != null && e != null) { if (i.PodeAtacar(e)) { i.Atacar(e); } } } } yield return(new WaitForSeconds(0.05f)); // ATAQUES DOS PORTUGUESES for (int b = 0; b < portugueses.Count; b++) { Explorador e = (Explorador)portugueses[b]; for (int a = 0; a < indios.Count; a++) { Indio i = (Indio)indios[a]; if (i != null && e != null) { if (e.PodeAtacar(i)) { e.Atacar(i); } } } } yield return(new WaitForSeconds(0.1f)); StartCoroutine(CheckAttacks()); }
public void DoRecrutar() { if (coolDown > 0) { return; } Indio novo = Instantiate(unidade); novo.transform.position = aldeia.transform.position; combatManager.manager.AddIndio(novo); coolDown = 5; //btn.interactable = false; StartCoroutine(BeginCooldown()); PrintCoolDown(); }
public void AddIndio(Indio i) { indios.Add(i); }