public void updateElementalText() { if (race == Race.Elemental) { elemental = SynergyHandler.instance.getElementals(); definition = "Deal " + elemental.getNumber() * 10 + " damage to enemy target"; } }
// Start is called before the first frame update void Start() { cooldownImage.fillAmount = 0; activated = false; onCooldown = false; board = FindObjectOfType <Board>(); outlinedUnit = new List <Unit>(); outline.enabled = false; //Initialize tooltips def switch (race) { case (Race.Orc): definition = "Pendant 5 secondes, les orcs dans la zone d'effet ignorent 30% de l'armure mais ils perdent 10% de précision"; cooldown = 10; break; case (Race.Skeleton): definition = "Les ennemis dans la zone d'effet perdent 25% d'armure pendant 5 secondes"; cooldown = 10; break; case (Race.Octopus): definition = "Etourdit la cible pendant 2 secondes"; cooldown = 15; break; case (Race.Elemental): elemental = SynergyHandler.instance.getElementals(); definition = $"Inflige {elemental.getNumber()*10} dégâts à l'ennemi ciblé"; cooldown = 10; break; case (Race.Giant): definition = "Sélectionnez un géant, sa prochaine attaque est plus puissante et étourdie la cible pendant 1 secondes"; cooldown = 8; break; case (Race.Ratman): definition = "La prochaine attaque des hommes-rats empoisonne l'ennemi infligeant 2 dégâts/seconde pendant 5 secondes"; cooldown = 10; break; case (Race.Demon): definition = "Invoque le roi démon, il possède moins de vie mais inflige plus de dégâts (par rapport aux statistiques d'un guerrier)"; cooldown = 60; break; } }
private void ActivateSpell() { List <Unit> affectedAllyUnit = new List <Unit>(); List <Unit> affectedEnemyUnit = new List <Unit>(); if (race != Race.Ratman) { affectedAllyUnit = PathfindingTool.unitsInRadius(currentCell, range, "UnitAlly"); affectedEnemyUnit = PathfindingTool.unitsInRadius(currentCell, range, "UnitEnemy"); } else { affectedAllyUnit = GameManager.instance.getUnit(); } bool launched = false; switch (race) { case (Race.Orc): foreach (Unit unit in affectedAllyUnit) { if (unit != null) { if (unit.getRace() == Race.Orc) { unit.activateOrcSpell(10, 5); launched = true; } } } if (launched == true) { onCooldown = true; cooldownImage.fillAmount = 1; activated = false; } break; case (Race.Skeleton): foreach (Unit unit in affectedEnemyUnit) { if (unit != null) { unit.activateSkeletonSpell(0.25f, 5); launched = true; } } if (launched == true) { onCooldown = true; cooldownImage.fillAmount = 1; activated = false; } break; case (Race.Octopus): foreach (Unit unit in affectedEnemyUnit) { if (unit != null) { unit.activateStun(2); launched = true; } } if (launched == true) { onCooldown = true; cooldownImage.fillAmount = 1; activated = false; } break; case (Race.Elemental): foreach (Unit unit in affectedEnemyUnit) { if (unit != null) { unit.activateElementalSpell(elemental.getNumber() * 10); launched = true; } } if (launched == true) { onCooldown = true; cooldownImage.fillAmount = 1; activated = false; } break; case (Race.Giant): foreach (Unit unit in affectedAllyUnit) { if (unit != null) { if (unit.getRace() == Race.Giant) { unit.activateGiantSpell(); launched = true; } } } if (launched == true) { onCooldown = true; cooldownImage.fillAmount = 1; activated = false; } break; case (Race.Ratman): foreach (Unit unit in affectedAllyUnit) { if (unit != null) { if (unit.CompareTag("UnitAlly") && unit.getRace() == Race.Ratman) { unit.activateRatmanSpell(); launched = true; } } } if (launched == true) { onCooldown = true; cooldownImage.fillAmount = 1; activated = false; } break; case (Race.Demon): if (currentCell.GetIsOccupied() == false && currentCell.GetIsObstacle() == false) { demonKing = Instantiate(demonKing); HealthbarHandler.ShowBars(); launched = true; } if (launched == true) { onCooldown = true; cooldownImage.fillAmount = 1; activated = false; } break; } }