public virtual void Damage(float value) { if (IsDead) { return; } if (!loadedHPBar) { GameEntry.Event.Fire(this, ShowEntityInLevelEventArgs.Create( (int)EnumEntity.HPBar, typeof(EntityHPBar), OnLoadHpBarSuccess, EntityDataFollower.Create(hpBarRoot))); loadedHPBar = true; } hp -= value; if (entityHPBar) { entityHPBar.UpdateHealth(hp / MaxHP); } if (hp <= 0) { hp = 0; Dead(); } }
protected virtual void Dead() { if (OnDead != null) { OnDead(this); } if (deadEffect != null) { GameEntry.Event.Fire(this, ShowEntityInLevelEventArgs.Create( (int)deadEffect.deadEffectEntity, typeof(EntityParticleAutoHide), null, EntityDataFollower.Create(randomSound ? randomSound.GetRandomSound() : EnumSound.None, transform.position + DeadEffectOffset, transform.rotation))); } }
private void ApplySlowEffect() { if (slowDownEffect == null && !loadSlowDownEffect) { GameEntry.Event.Fire(this, ShowEntityInLevelEventArgs.Create((int)EnumEntity.SlowFx, typeof(EntityAnimation), OnLoadSlowEffectSuccess, EntityDataFollower.Create(transform, ApplyEffectOffset, Vector3.one * ApplyEffectScale, EnumSound.None, transform.position, transform.rotation) ) ); loadSlowDownEffect = true; } }