Exemple #1
0
        private void TriggerOnGroundLandingEvents()
        {
            List <JumpAction.Event> events = jumpAction.FindEvents(
                JumpAction.Event.TriggerType.OnGroundLanding
                );

            for (int kIndex = 0; kIndex < events.Count; kIndex++)
            {
                JumpAction.Event            e  = events[kIndex];
                JumpAction.Event.ActionType at = e.ShowActionType();
                switch (at)
                {
                case JumpAction.Event.ActionType.CameraFx:
                    JumpAction.CameraFxEvent cfe    = (JumpAction.CameraFxEvent)e;
                    CameraAction.BaseFx      bf     = cfe.fx;
                    CameraAction.FxType      fxType = bf.ShowFxType();
                    switch (fxType)
                    {
                    case CameraAction.FxType.Shake:
                        CameraAction.ShakeFx sf = (CameraAction.ShakeFx)bf;
                        environment.ShakeCamera(
                            sf.strength, sf.duration, sf.vibrato, sf.smoothness, sf.randomness,
                            sf.useRandomInitialAngel, sf.rotation
                            );
                        break;

                    default:
                        throw new Exception("Missing logic to handle camera fx of type " + fxType);
                    }

                    break;

                case Event.ActionType.Vfx:
                    JumpAction.VfxEvent ve = (JumpAction.VfxEvent)e;
                    VfxAction.VfxType   vt = ve.fx.ShowVfxType();
                    switch (vt)
                    {
                    case VfxAction.VfxType.SpawnPrefab:
                        vfxLogic = new Vfxs.Vfx.SpawnPrefab(
                            5, (VfxAction.SpawnPrefabVfx)ve.fx,
                            new DefaultVfxGameObjectFactory(),
                            character,
                            SkillCastingSource.FromUserInput(),
                            environment.GetCamera(), environment, parentSkill
                            );
                        Timing.RunCoroutine(UpdateVfxLogic(vfxLogic));
                        break;
                    }
                    break;

                case Event.ActionType.Id:
                    parentSkill.TriggerEventWithId(((JumpAction.IdEvent)e).id);
                    break;

                default:
                    DLog.LogError("Missing logic to handle event of action type of " + at);
                    break;
                }
            }
        }
Exemple #2
0
        private void TriggerEvents()
        {
            List <Event> events = info.RagdollModifierConfig.ListAllEnabledEvents();

            for (int kIndex = 0; kIndex < events.Count; kIndex++)
            {
                Event e = events[kIndex];
                if (e.ShowTriggerType() != Event.TriggerType.OnGroundLanding)
                {
                    continue;
                }
                if (processedEvents.Contains(e))
                {
                    continue;
                }

                processedEvents.Add(e);
                Event.ActionType at = e.ShowActionType();
                switch (at)
                {
                case Event.ActionType.CameraFx:
                    JumpAction.CameraFxEvent cfe = (JumpAction.CameraFxEvent)e;
                    CameraAction.FxType      ft  = cfe.fx.ShowFxType();
                    switch (ft)
                    {
                    case CameraAction.FxType.Shake:
                        CameraAction.ShakeFx sf = (CameraAction.ShakeFx)cfe.fx;
                        ProCamera2DShake     proCamera2DShake;
                        proCamera2DShake = camera.GetComponent <ProCamera2DShake>();
                        if (proCamera2DShake == null)
                        {
                            proCamera2DShake = camera.gameObject.AddComponent <ProCamera2DShake>();
                        }

                        proCamera2DShake.Strength              = sf.strength;
                        proCamera2DShake.Duration              = sf.duration;
                        proCamera2DShake.Vibrato               = sf.vibrato;
                        proCamera2DShake.Smoothness            = sf.smoothness;
                        proCamera2DShake.Randomness            = sf.randomness;
                        proCamera2DShake.UseRandomInitialAngle = sf.useRandomInitialAngel;
                        proCamera2DShake.Rotation              = sf.rotation;
                        proCamera2DShake.Shake();
                        break;
                    }
                    break;

                case Event.ActionType.Vfx:
                    JumpAction.VfxEvent ve = (JumpAction.VfxEvent)e;
                    VfxAction.VfxType   vt = ve.fx.ShowVfxType();
                    switch (vt)
                    {
                    case VfxAction.VfxType.SpawnPrefab:
                        vfxLogic = new Vfxs.Vfx.SpawnPrefab(
                            10, (VfxAction.SpawnPrefabVfx)ve.fx,
                            new DefaultVfxGameObjectFactory(),
                            targetEntity.GetComponent <SkillComponent>().Character,
                            SkillCastingSource.FromUserInput(),
                            environment.GetCamera(), environment, null
                            );
                        break;
                    }
                    break;
                }
            }
        }