private void UpgradeUnits(string title, int level) { AnimaText animaText = new AnimaText(); for (int i = 0; i < Bench.SIZE; i++) { if (Bench.occupied[i]) { if (Bench.units[i].title == title && Bench.units[i].level < level) { Bench bench = new Bench(); bench.Destroy(i); animaText.ShowText(Bench.benches[i], "Upgraded", Color.green); } } } for (int i = 0; i < Formation.SIZE; i++) { if (Formation.occupied[i]) { if (Formation.units[i].title == title && Formation.units[i].level < level) { Formation formation = new Formation(); formation.Destroy(i); animaText.ShowText(Formation.formations[i], "Upgraded", Color.green); } } } }
public void TakeDamage(int damage) { health -= damage; if (health > healthMax) { health = healthMax; } AnimaText animaText = new AnimaText(); if (damage > 0) { animaText.ShowText(PlayerMovement.tilePos, damage.ToString(), Color.red); } else if (damage < 0) { animaText.ShowText(PlayerMovement.tilePos, damage.ToString(), Color.green); } else { animaText.ShowText(PlayerMovement.tilePos, damage.ToString(), Color.gray); } UnitStat unitStat = new UnitStat(); unitStat.DisplayStats(PlayerMovement.tilePos); }
public void Destroy(int tile) { if (enemies[tile].keyKeeper) { PlayerStat.keyObtained = true; AnimaText text = new AnimaText(); text.ShowText(tile, "Gate Key obtained", Color.cyan); } if (enemies[tile].artifactKeeper) { artifactKeepers--; if (artifactKeepers == 0) { Artifact artifact = new Artifact(); artifact.DropRandomArtifact(tile); AnimaText text = new AnimaText(); text.ShowText(tile, "Artifact Dropped", Color.cyan); } } if (enemies[tile].boss) { PlayerStat.bossKilled = true; AnimaText text = new AnimaText(); text.ShowText(tile, "Staircase opened", Color.cyan); } GameObject.Destroy(GameObject.Find("Enemy" + tile.ToString())); enemies[tile] = null; occupied[tile] = false; Tile.passable[tile] = true; }
public void Use(Unit unit) { AnimaText animaText = new AnimaText(); animaText.ShowText(Bf.bfs[unit.tile], "Ability Used", Color.cyan); Attack attack = new Attack(); switch (unit.title) { case "Crossbowman": for (int i = unit.tile % 3; i < 30; i += 3) { if (Bf.occupied[i]) { if (Bf.units[i].ally != unit.ally) { attack.DealDamage(unit.tile, i, unit.attack, "Magical"); } } } break; case "Dire Wolf": unit.rage += 3; break; case "Sentinel": int target = attack.DamageRandomInRange(unit, unit.attack * 3, "Magical"); Bf.units[target].armor -= unit.attack * 3; break; } unit.mana = 0; unit.UpdateDescription(Bf.bfs[unit.tile], unit); }
public void DamageEnemy(int damage, int tile) { Enemy.enemies[tile].health -= damage; UnitStat unitStat = new UnitStat(); unitStat.DisplayStats(tile); AnimaText animaText = new AnimaText(); animaText.ShowText(tile, damage.ToString(), Color.red); if (Enemy.enemies[tile].health <= 0) { Enemy enemy = new Enemy(); enemy.Destroy(tile); } }
public void PlayerClicked() { if (Tile.type[PlayerMovement.tilePos] == Tile.Type.End) { if (PlayerStat.bossKilled) { Level level = new Level(); level.WinLevel(); } else { AnimaText text = new AnimaText(); text.ShowText(PlayerMovement.tilePos, "Boss still alive", Color.red); } } }
private void OpenGate(int i) { if (Tile.type[i] == Tile.Type.TreasureGateClosed) { gateOpened = true; Tile tile = new Tile(); tile.AddGateOpen(i); AnimaText text = new AnimaText(); text.ShowText(i, "Gate Opened", Color.cyan); UI ui = new UI(); ui.EndTurn(); } }