public override void Update() { base.Update(); if (getHealth() < (50f * this.GetComponent <Enemy>().getMaxHealth()) / 100f && !_secondPhase) { Debug.Log("half life"); _secondPhase = true; _iceCrow.setVulnerability(false); _waterCrow.setVulnerability(false); //_waterCrow.DestroyMinion(); //_iceCrow.DestroyMinion(); //waterCrowDead = true; //iceCrowDead = true; //setSpawnCrowClock(Time.time); //_stateMachine.ChangeState(_spawnCrow); } else if (_secondPhase && Time.time > (_crowSpawnClock + _crowSpawnCountdown)) { if (waterCrowDead || iceCrowDead) { Debug.Log("time to spawn"); setSpawnCrowClock(Time.time); _stateMachine.ChangeState(_spawnCrow); } } else { Debug.Log("nothingHappened and life is : " + getHealth()); } }
public void crowSpawn() { if (iceCrowDead && waterCrowDead) { _iceClone = Instantiate(_IceCrowGO, new Vector3(0f, 1f, 0f), Quaternion.identity); _waterClone = Instantiate(_WaterCrowGO); _iceCrow = _iceClone.GetComponent <IceCrow>(); _waterCrow = _waterClone.GetComponent <WaterCrow>(); _iceCrow.setHalja(this); _waterCrow.setHalja(this); _waterCrow.setIceCrow(_iceCrow); _iceCrow.setWaterCrow(_waterCrow); _iceCrow.setVulnerability(true); _waterCrow.setVulnerability(false); } else if (iceCrowDead) { _iceClone = Instantiate(_IceCrowGO, new Vector3(0f, 1f, 0f), Quaternion.identity); _iceCrow = _iceClone.GetComponent <IceCrow>(); _waterCrow.setIceCrow(_iceCrow); _iceCrow.setWaterCrow(_waterCrow); _iceCrow.setHalja(this); _iceCrow.setVulnerability(false); } else if (waterCrowDead) { _waterClone = Instantiate(_WaterCrowGO); _waterCrow = _waterClone.GetComponent <WaterCrow>(); _iceCrow.setWaterCrow(_waterCrow); _waterCrow.setIceCrow(_iceCrow); _waterCrow.setHalja(this); _waterCrow.setVulnerability(false); } waterCrowDead = false; iceCrowDead = false; }