IEnumerator DeleteEnemyObject() { EnDisableFlip(); yield return(new WaitForSeconds(.2f)); EnAnimator.PlayDeathAnim(); if (bossPhase != null) { bossPhase.BossDead(); } yield return(new WaitForSeconds(1.0f)); if (DeathParticlesHandler != null) { Vector3 deathParticleLocation = transform.position; deathParticleLocation.y -= .4f; DeathParticlesHandler.ShowHitEffect(deathParticleLocation); } //gameObject.SetActive(false); //TODO: set to false so that EndPortal can reference if isAlive stageClear.UpdateEnemyCount(100f, 50); Destroy(this.gameObject); }
public override void Die() { isAlive = false; StopAllCoroutines(); if (DeathParticlesHandler != null) { Vector3 tempLocation = transform.position; tempLocation.y += hitEffectOffset; DeathParticlesHandler.ShowHitEffect(tempLocation); } stageClear.UpdateEnemyCount(XP, gold); StartCoroutine(DeleteEnemyObject()); }
protected virtual void Start() { sr = GetComponent <SpriteRenderer>(); rb = GetComponent <Rigidbody2D>(); mDefault = sr.material; healthBarTransform = healthBar.GetComponent <Transform>(); TextPopupsHandler = GameObject.Find("ObjectPool(TextPopups)").GetComponent <TextPopupsHandler>(); AttackIndicator = GameObject.Find("ObjectPool(Attack/Alert Indicators)").GetComponent <TextPopupsHandler>(); HitEffectsHandler = GameObject.Find("ObjectPool(HitEffects)").GetComponent <HitEffectsHandler>(); DeathParticlesHandler = GameObject.Find("ObjectPool(DeathParticles)").GetComponent <DeathParticlesHandler>(); if (stageClear == null) { stageClear = GetComponentInParent <StageClear>(); } //stageClear = GameObject.Find("StageClearCheck").GetComponent<StageClear>(); //if (useScreenshake) // screenshake = GameObject.Find("ScreenShakeManager").GetComponent<ScreenShakeListener>(); currentHealth = maxHealth; if (healthBar != null) { healthBar.SetMaxHealth(maxHealth); } moveSpeed = defaultMoveSpeed; moveSpeed += Random.Range(-.2f, .1f); enCanFlip = true; enCanMove = true; isAttacking = false; enCanAttack = true; enStunned = false; enCanParry = false; isAlive = true; isHurt = false; enStunned = false; }
public override void Die() //TODO: test { //base.Die(); StopAllCoroutines(); //stops attack coroutine if dead EnDisableMove(); isAlive = false; enCanAttack = false; ShowHealthBar(false); if (DeathParticlesHandler != null) { Vector3 deathParticleLocation = transform.position; deathParticleLocation.y += hitEffectOffset; DeathParticlesHandler.ShowHitEffect(deathParticleLocation); } StartCoroutine(DeleteEnemyObject()); }
// Use this for initialization void Start() { sr = GetComponent <SpriteRenderer>(); rb = GetComponent <Rigidbody2D>(); mDefault = sr.material; healthBarTransform = healthBar.GetComponent <Transform>(); TextPopupsHandler = GameObject.Find("ObjectPool(TextPopups)").GetComponent <TextPopupsHandler>(); AttackIndicator = GameObject.Find("ObjectPool(Attack/Alert Indicators)").GetComponent <TextPopupsHandler>(); HitEffectsHandler = GameObject.Find("ObjectPool(HitEffects)").GetComponent <HitEffectsHandler>(); DeathParticlesHandler = GameObject.Find("ObjectPool(DeathParticles)").GetComponent <DeathParticlesHandler>(); moveSpeed = moveSpeedDefault; enCanFlip = true; enCanMove = true; enCanParry = false; isAttacking = false; aggroStarted = false; enIsHurt = false; enStunned = false; knockbackHit = false; isAlive = true; enCanAttack = true; //Stats currentHealth = maxHealth; if (healthBar != null) { healthBar.SetMaxHealth(maxHealth); } moveSpeed += Random.Range(-.2f, .1f); bool startDir = (Random.value > 0.5f); MoveRight(startDir); }