protected void Death() { m_bIsAlive = false; if (Player.m_player.BurningSpeedBoost) { --Player.m_player.EnemiesOnFire; } m_explosionManager.RequestExplosion(this.transform.position, this.transform.forward, Explosion.ExplosionType.BigBlood, 0.0f); m_explosionManager.RequestExplosion(this.transform.position, this.transform.forward, Explosion.ExplosionType.Gibs, 0.0f); this.gameObject.SetActive(false); //Destroy(gameObject); }
private void OnCollisionEnter(Collision a_collision) { m_explosionManager.RequestExplosion(transform.position, -m_v3Direction, Explosion.ExplosionType.BulletImpact, 0.0f); m_enemy = a_collision.collider.GetComponent <Entity>(); if (m_enemy != null) { m_enemy.m_currHealth -= m_iDamage; m_explosionManager.RequestExplosion(transform.position, -m_v3Direction, Explosion.ExplosionType.SmallBlood, 0.0f); } gameObject.SetActive(false); }
protected virtual void OnCollisionEnter(Collision collision) { if (m_id == "") { return; } if (!collision.collider.CompareTag(m_id)) { m_explosionManager.RequestExplosion(this.transform.position, -m_direction, Explosion.ExplosionType.BulletImpact, 0.0f); m_enemy = collision.collider.GetComponent <Entity>(); //do base damage if (m_enemy != null) { m_enemy.m_beenCrit = this.m_isCrit; m_enemy.m_currHealth -= m_damage; m_enemy.m_recentDamageTaken = m_damage; m_explosionManager.RequestExplosion(this.transform.position, -m_direction, Explosion.ExplosionType.SmallBlood, 0.0f); } } }
protected void HealthUpdate() { if (m_oldHealth != m_currHealth) { Color textColor = Color.white; if (m_beenCrit) { textColor = Color.red; m_beenCrit = false; } if (m_currHealth > m_oldHealth) { textColor = Color.green; } m_damageNumbersManager.CreateDamageNumber(Mathf.Abs(m_oldHealth - m_currHealth).ToString(), this.transform, textColor); } //cant go above max if (m_currHealth > m_maxHealth) { m_currHealth = m_maxHealth; } //if dead if (m_currHealth <= 0) { if (!m_godMode) { m_explosionManager.RequestExplosion(this.transform.position, this.transform.forward, Explosion.ExplosionType.BigBlood, 0.0f); m_explosionManager.RequestExplosion(this.transform.position, this.transform.forward, Explosion.ExplosionType.Gibs, 0.0f); this.gameObject.SetActive(false); //GameObject.Destroy(this.gameObject, Time.deltaTime); } else { m_currHealth = 1; } //handle death state } ///STATUS EFFECTS //if set on fire and previously not on fire. to avoid effect stacking if (m_setOnFire && !m_onFire) { m_statusEffectManager.RequestEffect(this.transform, StatusEffect.Status.OnFire); m_setOnFire = false; } if (m_causeSlow && !m_isSlowed) { m_statusEffectManager.RequestEffect(this.transform, StatusEffect.Status.Slowed); m_causeSlow = false; } if (m_causeStun && !m_isStunned) { m_statusEffectManager.RequestEffect(this.transform, StatusEffect.Status.Stunned); m_causeStun = false; } if (!m_isBuffed && HealthBelowPercentCheck(10) && m_hasRamboPerk) { m_statusEffectManager.RequestEffect(this.transform, StatusEffect.Status.Buffed); } if (!m_ringOfFireActive && HealthBelowPercentCheck(25) && m_hasRingOfFire) { m_statusEffectManager.RequestEffect(this.transform, StatusEffect.Status.FireRing); } if (!m_lightningFieldActive && HealthBelowPercentCheck(25) && m_hasLightningField) { m_statusEffectManager.RequestEffect(this.transform, StatusEffect.Status.LightningRing); } m_oldHealth = m_currHealth; }