private IEnumerator SpawnLoop() { yield return(new WaitForSeconds(3f)); Spawner.SpawnSoldier(); yield return(new WaitForSeconds(3f)); Spawner.SpawnWizard(); yield return(new WaitForSeconds(3f)); Spawner.SpawnArcher(); yield return(new WaitForSeconds(1f)); List <GameObject> Units = Spawner.GetAllSpawnedUnits(); foreach (GameObject u in Units) { if (u != null) { if (u.transform.localScale.x < 2f) { StartCoroutine(SpellEffectsService.GetInstance().EmbiggenEffect(u)); } } } SpawnRoutine = StartCoroutine(SpawnLoop()); }
public void CastEmbiggen() { if (CanCast()) { LevelManagerService.GetInstance().CurrentPlayerMana -= 3; List <GameObject> units = PlayerSpawner.GetAllSpawnedUnits(); foreach (GameObject u in units) { if (u != null) { StartCoroutine(SpellEffectsService.GetInstance().EmbiggenEffect(u)); } } } }
public void CastFreeze() { if (CanCast()) { OpponentSpawner.LockSpawner(); LevelManagerService.GetInstance().CurrentPlayerMana -= 3; StartCoroutine(UnlockSpawnerAfter(10f)); List <GameObject> units = OpponentSpawner.GetAllSpawnedUnits(); foreach (GameObject u in units) { if (u != null) { SpellEffectsService.GetInstance().FreezeEffect(u, 10f); } } } }
void Update() { if (FreezeUpdateLoop) { return; } if (Input.GetKey(KeyCode.Space)) { UnitSpawner.SpawnSoldier(); } List <Tile> tilesToRemove = GetRemovableTiles(); Dictionary <string, int> removedTileCounts = new Dictionary <string, int>(); if (tilesToRemove.Count > 0) { foreach (Tile ttr in tilesToRemove) { if (!removedTileCounts.ContainsKey(ttr.Name)) { removedTileCounts[ttr.Name] = 0; } removedTileCounts[ttr.Name]++; Vector2 ttrc = GetTileCoordinates(ttr); TileMap[(int)ttrc.y][(int)ttrc.x].Tile.Remove(); TileMap[(int)ttrc.y][(int)ttrc.x].Tile = null; } if (removedTileCounts.ContainsKey("Sword") || removedTileCounts.ContainsKey("Arrow") || removedTileCounts.ContainsKey("Thunder") || removedTileCounts.ContainsKey("Shield") || removedTileCounts.ContainsKey("Void") ) { SfxManagerService.GetInstance().PlayTilePop(); } if (removedTileCounts.ContainsKey("Skull")) { SfxManagerService.GetInstance().PlaySkullPop(); } if (removedTileCounts.ContainsKey("Sword")) { while (removedTileCounts["Sword"] >= 3) { UnitSpawner.SpawnSoldier(); removedTileCounts["Sword"] -= 3; } } if (removedTileCounts.ContainsKey("Arrow")) { while (removedTileCounts["Arrow"] >= 3) { UnitSpawner.SpawnArcher(); removedTileCounts["Arrow"] -= 3; } } if (removedTileCounts.ContainsKey("Thunder")) { while (removedTileCounts["Thunder"] >= 3) { UnitSpawner.SpawnWizard(); removedTileCounts["Thunder"] -= 3; } } if (removedTileCounts.ContainsKey("Void")) { while (removedTileCounts["Void"] >= 3) { if (LevelManagerService.GetInstance().CurrentPlayerMana < 3) { StartCoroutine(IncreaseManaByXOverT(1, 0.5f)); } removedTileCounts["Void"] -= 3; } } if (removedTileCounts.ContainsKey("Skull")) { float skullDamage = Mathf.Min(removedTileCounts["Skull"] / 2); while (removedTileCounts["Skull"] >= 3) { removedTileCounts["Skull"] -= 3; List <GameObject> PlayerSpawnedUnits = UnitSpawner.GetAllSpawnedUnits(); foreach (GameObject u in PlayerSpawnedUnits) { if (u != null) { DamagableUnit d = u.GetComponent <DamagableUnit>(); if (d != null) { d.TakeDamage(skullDamage); } } } } } StartCoroutine(PushTiles()); } }