protected virtual void OnReceiveAbilityHit(Entity ent, AbilityCastResult result) { Vector3 knockback = DetermineAbilityHitKnockback(result); references.RigidBody.velocity += knockback; result.FillKnockbackApplied(knockback); }
private void OnEntityDeath(Entity ent, AbilityCastResult killingResult) { if (_entityChunks.ContainsKey(ent)) { _entityChunks.Remove(ent); } }
protected virtual void HandleDeath() { if (deathResult != null) { OnDeath.Invoke(master, deathResult); deathResult = null; } }
public static void HandleAbilityCastResultFX(AbilityCastResult result, AbilityVisualData.AbilityVisualFX fx) { GameObject fxGo = PinouApp.Pooler.Retrieve(fx.Model, PinouApp.Scene.ActiveSceneInfos.FXsHolder); HandleAbilityPlacingMethod(fxGo, result, fx); HandleAbilityDirectionMethod(fxGo, result, fx); HandleAbilityDestroyMethod(fxGo, result.CastData, fx); fx.FXVisualParameters.Apply(fxGo); }
private void OnReceiveAbilityHit(Entity master, AbilityCastResult castResult) { if (HasTarget == false) { if (IsEntityAuthorizedTarget(castResult.CastData.Caster)) { target = castResult.CastData.Caster; } } }
public static void ApplyAbilityPerformedOnHitEntity(AbilityCastData castData, Entity entity, AbilityCastResult existingResult = null) { AbilityCastResult result = existingResult == null ? new AbilityCastResult(castData) : existingResult; result.FillVictim(entity); if (result.ImpactFilled == false) { result.FillImpact(ComputePerformedAbilityImpact(castData, entity)); } entity.ReceiveAbilityHit(result); }
protected void TakeAbilityHit(AbilityCastResult result) { float oldHealth = currentHealth; ModifyHealth(result.CastData.GetResourceImpact(EntityBeingResourceType.Health)); result.FillResourceChange(EntityBeingResourceType.Health, currentHealth - oldHealth); if (BeingState == BeingState.Dead) { Death(result); } }
public static void HandleAbilityCastResultVisual(AbilityCastResult result) { if (result.CastData.AbilityCast.Visual.HasFX == false) { return; } for (int i = 0; i < result.CastData.AbilityCast.Visual.FXs.Length; i++) { if (result.CastData.AbilityCast.Visual.FXs[i].TimingMethod == AbilityVisualData.AbilityVisualFXTimingMethod.Result) { HandleAbilityCastResultFX(result, result.CastData.AbilityCast.Visual.FXs[i]); } } }
private static void HandleAbilityDirectionMethod(GameObject fxGo, AbilityCastResult result, AbilityVisualData.AbilityVisualFX resultFx) { if (resultFx.PlacingMethod != AbilityVisualData.AbilityVisualFXPlacingMethod.Script) { switch (resultFx.DirectionMethod) { case AbilityVisualData.AbilityResultDirectionMethod.CastDirection: HandleAbilityDirectionMethod(fxGo, result.CastData, resultFx); break; case AbilityVisualData.AbilityResultDirectionMethod.KnockbackDirection: fxGo.transform.rotation = Quaternion.LookRotation(result.KnockbackApplied.normalized); break; } } }
private void ApplyHitOnEntity(Entity ent, AbilityPerformer.AdditionalHitInfos infos) { AbilityCastResult result = null; if (infos != null) { result = new AbilityCastResult(_castData); Vector3 impact = infos.Hit.point; if (impact.sqrMagnitude <= Mathf.Epsilon) { impact = infos.RayOrigin; } result.FillImpact(impact); } AbilityPerformer.ApplyAbilityPerformedOnHitEntity(_castData, ent, result); HandleCheckHitboxLife(); }
private static void HandleAbilityPlacingMethod(GameObject fxGo, AbilityCastResult result, AbilityVisualData.AbilityVisualFX resultFx) { switch (resultFx.PlacingMethod) { case AbilityVisualData.AbilityVisualFXPlacingMethod.Caster: HandleAbilityPlacingMethod(fxGo, result.CastData, resultFx); break; case AbilityVisualData.AbilityVisualFXPlacingMethod.Impact: fxGo.transform.position = result.Impact; break; case AbilityVisualData.AbilityVisualFXPlacingMethod.Victim: fxGo.transform.position = result.Victim.Position; break; case AbilityVisualData.AbilityVisualFXPlacingMethod.Script: fxGo.GetComponent <FX_Base>().StartFX(result); break; } }
protected Vector3 DetermineAbilityHitKnockback(AbilityCastResult result) { switch (result.CastData.AbilityCast.Methods.KnockbackMethod) { case KnockbackMethod.AttackBased: return(PinouUtils.Transform.TransformVector(result.CastData.BaseKnockback, Quaternion.LookRotation(result.CastData.CastDirection)) * KnockbackTakenFactor); case KnockbackMethod.AttackEntityAverage: return ((PinouUtils.Transform.TransformVector(result.CastData.BaseKnockback, Quaternion.LookRotation(result.CastData.CastDirection)) + references.VisualBody.TransformVector(result.CastData.BaseKnockback)) * 0.5f * KnockbackTakenFactor); case KnockbackMethod.VictimEntityBased: return(references.VisualBody.TransformVector(result.CastData.BaseKnockback) * KnockbackTakenFactor); case KnockbackMethod.AttackImpactToEntity: return(PinouUtils.Transform.TransformVector(result.CastData.BaseKnockback, PinouUtils.Quaternion.SafeLookRotation(Position - result.Impact, result.CastData.CastDirection)) * KnockbackTakenFactor); case KnockbackMethod.CasterToVictim: return(PinouUtils.Transform.TransformVector(result.CastData.BaseKnockback, Quaternion.LookRotation(result.Victim.Position - result.CastData.Caster.Position)) * KnockbackTakenFactor); } throw new System.Exception("KnockbackMethod enum updated, this should be too."); }
public void FillResult(AbilityCastResult result) { _results.Add(result); OnResultEmitted.Invoke(this, result); }
private void OnDeath(Entity ent, AbilityCastResult killingResult) { AbilityPerformer.HandleAbilityCastResultFX(killingResult, Data._deathFX); }
private void OnAbilityHitResult(Entity ent, AbilityCastResult result) { AbilityPerformer.HandleAbilityCastResultVisual(result); }
protected void Death(AbilityCastResult killingResult) { deathResult = killingResult; }
private void OnCastDataEmitResult(AbilityCastData castData, AbilityCastResult result) { OnAbilityHitResultEmitted.Invoke(master, result); }
private void OnReceiveAbilityHit(Entity master, AbilityCastResult result) { TakeAbilityHit(result); }