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 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 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; } }
private static void HandleAbilityDestroyMethod(GameObject fxGo, AbilityCastData castData, AbilityVisualData.AbilityVisualFX castFx) { if (castFx.DestroyMethod == AbilityVisualData.AbilityVisualFXDestroyMethod.Timed) { PinouUtils.Coroutine.Invoke(PinouApp.Pooler.Store, castFx.DestroyTime, fxGo, true); } }
private static void HandleAbilityDirectionMethod(GameObject fxGo, AbilityCastData castData, AbilityVisualData.AbilityVisualFX castFx) { if (castFx.PlacingMethod != AbilityVisualData.AbilityVisualFXPlacingMethod.Script) { switch (castFx.DirectionMethod) { case AbilityVisualData.AbilityResultDirectionMethod.CastDirection: fxGo.transform.rotation = PinouUtils.Quaternion.SafeLookRotation(castData.CastDirection, Vector3.right); break; case AbilityVisualData.AbilityResultDirectionMethod.KnockbackDirection: Debug.LogError("Wrong parameter: " + castFx.DirectionMethod + " for a cast FX"); break; } } }
private static void HandleAbilityPlacingMethod(GameObject fxGo, AbilityCastData castData, AbilityVisualData.AbilityVisualFX castFx) { switch (castFx.PlacingMethod) { case AbilityVisualData.AbilityVisualFXPlacingMethod.Caster: fxGo.transform.position = castData.Caster.Position; break; case AbilityVisualData.AbilityVisualFXPlacingMethod.Script: fxGo.GetComponent <FX_Base>().StartFX(castData); break; case AbilityVisualData.AbilityVisualFXPlacingMethod.Impact: case AbilityVisualData.AbilityVisualFXPlacingMethod.Victim: Debug.LogError("Wrong parameter: " + castFx.PlacingMethod + " for a cast FX"); break; } }