public void PrepareFireball() { if (!IsAiming) { IsAiming = true; LevelManagerService.GetInstance().CurrentPlayerMana -= 3; } }
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); } } } }
private IEnumerator IncreaseManaByXOverT(float amount, float time) { float cTime = 0f; while (cTime < time) { if (LevelManagerService.GetInstance().CurrentPlayerMana >= 3) { break; } yield return(new WaitForEndOfFrame()); LevelManagerService.GetInstance().CurrentPlayerMana += amount * (Time.deltaTime / time); cTime += Time.deltaTime; } }
private IEnumerator SpawnLoop() { float relativeScore = (360 - LevelManagerService.GetInstance().GetTimeRemaining()) / 360; if (LevelManagerService.GetInstance().GetTimeRemaining() < 300) { if (SpawnTime > 2f) { LevelManagerService.GetInstance().SplashLabel.text = "Speeding Up!"; yield return(new WaitForSeconds(3)); LevelManagerService.GetInstance().SplashLabel.text = ""; SpawnTime = 2f; } } if (LevelManagerService.GetInstance().GetTimeRemaining() < 240) { if (SpawnTime > 1.5f) { LevelManagerService.GetInstance().SplashLabel.text = "Speeding Up!!"; yield return(new WaitForSeconds(3)); LevelManagerService.GetInstance().SplashLabel.text = ""; SpawnTime = 1.5f; } } if (LevelManagerService.GetInstance().GetTimeRemaining() < 180) { if (SpawnTime > 1.5f) { LevelManagerService.GetInstance().SplashLabel.text = "Speeding Up!!!"; yield return(new WaitForSeconds(3)); LevelManagerService.GetInstance().SplashLabel.text = ""; SpawnTime = 1.5f; } } if (LevelManagerService.GetInstance().GetTimeRemaining() < 60) { if (SpawnTime > 1f) { LevelManagerService.GetInstance().SplashLabel.text = "Speeding Up!!!!"; yield return(new WaitForSeconds(3)); LevelManagerService.GetInstance().SplashLabel.text = ""; SpawnTime = 1f; } } if (LevelManagerService.GetInstance().GetTimeRemaining() < 60) { if (SpawnTime > 0.75f) { LevelManagerService.GetInstance().SplashLabel.text = "Speeding Up!!!!!"; yield return(new WaitForSeconds(3)); LevelManagerService.GetInstance().SplashLabel.text = ""; SpawnTime = 0.75f; } } Spawner.SpawnSoldier(); yield return(new WaitForSeconds(SpawnTime)); Spawner.SpawnArcher(); yield return(new WaitForSeconds(SpawnTime)); Spawner.SpawnWizard(); yield return(new WaitForSeconds(SpawnTime)); SpawnRoutine = StartCoroutine(SpawnLoop()); }
public override void StartSpawning() { LevelManagerService.GetInstance().SetTimeRemaining(360); SpawnRoutine = StartCoroutine(SpawnLoop()); }
private bool CanCast() { return(LevelManagerService.GetInstance().CurrentPlayerMana >= 3); }
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()); } }
void Awake() { Instance = this; CompletedChallenges = new List <String>(); }