Esempio n. 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;
                }
            }
        }
Esempio n. 2
0
 public StatsModifier(ModifierInfo info, Entity casterEntity,
                      Entity targetEntity, Environment environment,
                      CollectionOfInteractions modifierInteractionCollection,
                      SkillCastingSource src) : base(info, casterEntity, targetEntity, environment, modifierInteractionCollection)
 {
     this.src              = src;
     this.info             = (StatsInfo)info;
     targetStatsComponent  = targetEntity.GetComponent <StatsComponent>();
     targetHealthComponent = targetEntity.GetComponent <HealthComponent>();
     statsType             = this.info.Smc.ShowStatsType();
     targetHero            = (DefaultHero)targetEntity.GetComponent <HeroStateMachineComponent>().StateMachineHero;
 }
        private void CheckCastSkill()
        {
            if (isFinished || !isTriggered || !isTargetSet)
            {
                return;
            }

            isFinished = true;

            SkillComponent skillComponent = target.GetComponent <SkillComponent>();

            skillComponent.Character.CastSkill(skillId, SkillCastingSource.FromSystem());
        }
Esempio n. 4
0
        private void ProcessVfx(float dt)
        {
            for (int i = pendingVfxs.Count - 1; i >= 0; i--)
            {
                try {
                    VfxConfig vc = pendingVfxs[i];
                    if (elapsed >= FrameAndSecondsConverter._30Fps.FramesToSeconds(vc.frame))
                    {
                        pendingVfxs.RemoveAt(i);
                        VfxLogic          logic   = null;
                        VfxAction.VfxType vfxType = vc.vfx.ShowVfxType();
                        switch (vfxType)
                        {
                        case VfxAction.VfxType.SpawnPrefab:
                            SpawnPrefabVfx spv    = (SpawnPrefabVfx)vc.vfx;
                            VfxTag         vfxTag = spv.ShowVfxPrefab().GetComponent <VfxTag>();
                            if (vfxTag)
                            {
                                if (vfxTag.tag == VfxTag.Tag.Startup)
                                {
                                    if (isOverrideMode && isOverridingModifierOfSameType)
                                    {
                                        //DLog.Log("Skip spawn startup vfx");
                                        continue;
                                    }

                                    if (!isStartupVfxPlayed)
                                    {
                                        startupVfxCoroutine = Timing.RunCoroutine(LoopStartupVfx_());
                                    }
                                    isStartupVfxPlayed = true;
                                    //DLog.Log("Spawn startup vfx");
                                    startupVfxLogics.Add(new SpawnPrefab(
                                                             vc.ttl, (SpawnPrefabVfx)vc.vfx,
                                                             new Vfx.DefaultVfxGameObjectFactory(environment), target,
                                                             SkillCastingSource.FromUserInput(), environment.GetCamera(),
                                                             environment, null
                                                             ));
                                    continue;
                                }
                            }
                            logic = new SpawnPrefab(
                                vc.ttl, (SpawnPrefabVfx)vc.vfx,
                                new Vfx.DefaultVfxGameObjectFactory(environment), target,
                                SkillCastingSource.FromUserInput(), environment.GetCamera(),
                                environment, null
                                );
                            OnVfxPrefabSpawn((SpawnPrefab)logic);
                            break;

                        case VfxAction.VfxType.ChangeMaterial:
                            logic = new ChangeMaterial(
                                (VfxAction.ChangeMaterialVfx)vc.vfx, vc.ttl, environment, target
                                );
                            break;

                        case VfxAction.VfxType.ChangeMaterialColor:
                            logic = new ChangeMaterialColor(
                                (VfxAction.ChangeMaterialColorVfx)vc.vfx, vc.ttl, environment, target
                                );
                            break;

                        case VfxAction.VfxType.AddMaterial:
                            logic = new AddMaterialLogic(
                                (VfxAction.AddMaterialVfx)vc.vfx, vc.ttl, target
                                );
                            break;

                        default:
                            throw new Exception("Missing logic to create vfx logic of type " + vfxType);
                        }
                        vfxLogics.Add(logic);
                    }
                }
                catch (Exception e) {
                    DLog.LogException(e);
                }
            }

            for (int i = vfxLogics.Count - 1; i >= 0; i--)
            {
                vfxLogics[i].Update(dt);
                if (vfxLogics[i].IsFinish())
                {
                    vfxLogics.RemoveAt(i);
                }
            }
        }
Esempio n. 5
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;
                }
            }
        }