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(); } }
public static EntityDataFollower Create(Transform follow, object userData = null) { EntityDataFollower entityData = ReferencePool.Acquire <EntityDataFollower>(); entityData.Follow = follow; entityData.UserData = userData; return(entityData); }
protected override void OnHide(bool isShutdown, object userData) { base.OnHide(isShutdown, userData); entityDatafollower = null; transform.localScale = Vector3.one; anim.Stop(); }
protected override void OnHide(bool isShutdown, object userData) { base.OnHide(isShutdown, userData); cameraToFace = null; entityDataFollower = null; UpdateHealth(1); SetVisible(false); }
public static EntityDataFollower Create(Transform follow, Vector3 offset, Vector3 scale, object userData = null) { EntityDataFollower entityData = ReferencePool.Acquire <EntityDataFollower>(); entityData.Follow = follow; entityData.Offset = offset; entityData.Scale = scale; entityData.UserData = userData; return(entityData); }
public static EntityDataFollower Create(Transform follow, Vector3 offset, EnumSound enumSound, object userData = null) { EntityDataFollower entityData = ReferencePool.Acquire <EntityDataFollower>(); entityData.Follow = follow; entityData.Offset = offset; entityData.ShowSound = enumSound; entityData.UserData = userData; return(entityData); }
public static EntityDataFollower Create(EnumSound enumSound, Vector3 position, Quaternion rotation, object userData = null) { EntityDataFollower entityData = ReferencePool.Acquire <EntityDataFollower>(); entityData.ShowSound = enumSound; entityData.Position = position; entityData.Rotation = rotation; entityData.UserData = userData; return(entityData); }
protected override void OnHide(bool isShutdown, object userData) { base.OnHide(isShutdown, userData); entityDataFollower = null; transform.localScale = Vector3.one; pauseTime = 0; ps.Stop(true); }
public static EntityDataFollower Create(Transform follow, Vector3 offset, Vector3 scale, EnumSound enumSound, Vector3 position, Quaternion rotation, object userData = null) { EntityDataFollower entityData = ReferencePool.Acquire <EntityDataFollower>(); entityData.Follow = follow; entityData.Offset = offset; entityData.Scale = scale; entityData.ShowSound = enumSound; entityData.Position = position; entityData.Rotation = rotation; entityData.UserData = userData; return(entityData); }
protected override void OnShow(object userData) { base.OnShow(userData); cameraToFace = Camera.main.transform; entityDataFollower = userData as EntityDataFollower; if (entityDataFollower == null) { Log.Error("EntityHPBar param invaild"); return; } }
protected override void OnShow(object userData) { base.OnShow(userData); entityDatafollower = userData as EntityDataFollower; if (entityDatafollower == null) { Log.Error("EntityParticle '{0}' entity data invaild.", Id); return; } transform.localScale = entityDatafollower.Scale; anim.Play(); }
protected override void OnShow(object userData) { base.OnShow(userData); entityDataFollower = userData as EntityDataFollower; if (entityDataFollower == null) { return; } GameEntry.Sound.PlaySound(entityDataFollower.ShowSound, Entity); transform.localScale = entityDataFollower.Scale; ps.Play(true); }
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; } }