// Update is called once per frame void Update() { if (!waveOn) { waveNotifier.SetActive(true); wavetime += Time.deltaTime * Time.timeScale; if ((wavetime) >= wave_start) { waveOn = true; waveNotifier.SetActive(false); PlayerBehaviors.wave += 1; points = start_points * PlayerBehaviors.wave * 3; wavetime = 0; } } else { GameObject current_enemy = null; time += Time.deltaTime * Time.timeScale; if ((time) >= SpawnTimer) { if (points >= 0) { this.time = 0; current_enemy = CreateEnemy(); SpawnTimer = Random.Range(0.2f, 1.0f); } } if (current_enemy != null) { //move enemy_stats LeanTween.moveSpline(current_enemy, mg.ltpath, mg.ltpath.distance * Time.timeScale / current_enemy.GetComponent <Enemy>().speed); //add enemy to global enemy list if (current_enemy != null) { CreatePath.enemies.Add(current_enemy); current_enemy = null; } } if (points <= 0 && CreatePath.enemies.Count == 0) { waveOn = false; foreach (GameObject tower in CreatePath.towers) { AbstractTower tower_stats = tower.GetComponent <AbstractTower>(); if (tower_stats is BankTower) { PlayerBehaviors.money += tower_stats.damage; } } } } }
void Update() { if (Input.GetButtonDown("advance")) { selectedTower += 1; if (selectedTower >= towers.Length) { selectedTower = 0; } currentComp = getTowerComp(); } else if (Input.GetButtonDown("back")) { selectedTower -= 1; if (selectedTower < 0) { selectedTower = towers.Length - 1; } currentComp = getTowerComp(); } }
public static void run() { BuildingFactory factory = BuildingFactory.getInstance(); AbstractTower testTower1 = factory.createTower("frost", 0, 0); AbstractProjectileContainer testShot = testTower1.fire(2, 3); while (!testShot.updateLocation()) { } testShot = null; //State & Caretaker demo testTower1.upgrade(); testTower1.fire(3, 5); testTower1.upgrade(); testTower1.upgrade(); Caretaker caretaker = new Caretaker(testTower1); caretaker.backupState(); testTower1.destroy(); testTower1.fire(5, 3); caretaker.restoreState(); testTower1.fire(6, 7); }
public void TriggerDeath() { GetComponent <PoolInstance>().Remove(); m_hp = m_maxHP; AbstractTower.OnMonsterDeadEvent(this); }
void Start() { currentComp = getTowerComp(); }
public LevelState(AbstractTower tower) { context = tower; }
private void Awake() { radius = gameObject.AddComponent <SphereCollider>(); tower = gameObject.GetComponentInParent <AbstractTower>(); }