public void UnitGen(GameObject unit, Vector3 lane, UnitIA stats, int fila) { // print("dinero actual: [" + dinero + "] | costo Unidad: [" + hackerStats.costUnit + ']'); unit.GetComponent <SpriteRenderer>().sortingOrder = fila + 1; Instantiate(unit, lane, Quaternion.Euler(Vector3.zero)); dinero -= stats.costUnit; }
private void Attack(UnitIA other) { other.lifePoints -= attackPower; if (other.CompareTag("Torre")) { healthBarP1.fillAmount = other.lifePoints / maxTowerLife; } if (other.CompareTag("TorreEnemiga")) { healthBarP2.fillAmount = other.lifePoints / maxTowerLife; } if (other.lifePoints <= 0) { if (other.CompareTag("Torre")) { WinnerHolder.winner = "Clientes"; Destroy(other.gameObject); SceneManager.LoadScene("Winner"); // Cargar pantalla de fin } else if (other.CompareTag("TorreEnemiga")) { WinnerHolder.winner = "Sistemas"; Destroy(other.gameObject); SceneManager.LoadScene("Winner"); // Cargar pantalla de fin } else { _unitMan.dinero += other.costUnit - 50f; print("Banco: [" + _unitMan.dinero + "] " + "Ganancia: [" + other.costUnit + ']'); Destroy(other.gameObject); } } }
void Start() { if (CompareTag("Torre")) { hackerStats = hacker.GetComponent <UnitIA>(); designerStats = designer.GetComponent <UnitIA>(); cioStats = cio.GetComponent <UnitIA>(); pos = new[] { new Vector3(-15f, -6.32f), new Vector3(-15f, -7.32f), new Vector3(-15f, -8.4f) }; } if (CompareTag("TorreEnemiga")) { emprendedorStats = emprendedor.GetComponent <UnitIA>(); jefeStats = jefe.GetComponent <UnitIA>(); abuelaStats = abuela.GetComponent <UnitIA>(); pos = new[] { new Vector3(15f, -6.32f), new Vector3(15f, -7.32f), new Vector3(15f, -8.4f) }; } }