Пример #1
0
        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);
        }
Пример #2
0
        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;
                }
            }
        }
Пример #3
0
        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;
            }
        }
Пример #4
0
 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);
     }
 }
Пример #5
0
        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;
                }
            }
        }
Пример #6
0
        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;
            }
        }