Exemple #1
0
 private void MonsterCastBuff(TestSpell spell)
 {
     if (m_ActiveMonster == null)
     {
         return;
     }
     foreach (BuffFX buffFX in m_MonsterBuffEffects)
     {
         if (buffFX != null)
         {
             buffFX.Destroy();
         }
     }
     m_MonsterBuffEffects.Clear();
     foreach (FXQueue fxqueue in m_MonsterBuffGameObjects)
     {
         if (fxqueue != null)
         {
             Destroy(fxqueue.gameObject, 5f);
         }
     }
     m_MonsterBuffGameObjects.Clear();
     foreach (String text in spell.TargetBuffEffectPath)
     {
         if (!String.IsNullOrEmpty(text))
         {
             BuffFX buffFX2 = Helper.ResourcesLoad <BuffFX>(text, false);
             if (buffFX2 != null)
             {
                 Vector3 forward    = m_Party.transform.forward;
                 Vector3 p_slotLeft = -m_Party.transform.right;
                 buffFX2 = Helper.Instantiate <BuffFX>(buffFX2);
                 FXQueue fxqueue2 = new GameObject("FXQueue " + buffFX2.name).AddComponent <FXQueue>();
                 fxqueue2.SetData(new FXQueue.Entry[]
                 {
                     new FXQueue.Entry(buffFX2, 0f, 0f)
                 }, 0);
                 FXArgs args = new FXArgs(m_ActiveMonster, m_ActiveMonster, m_ActiveMonster, m_ActiveMonster, m_ActiveMonster.transform.position, forward, p_slotLeft, m_ActiveMonster.transform.position);
                 fxqueue2.Execute(args);
                 m_MonsterBuffGameObjects.Add(fxqueue2);
                 m_MonsterBuffEffects.Add(buffFX2);
                 m_ActiveMonsterAnimationHandler.Hit();
             }
             else
             {
                 Debug.LogError("MonsterCastBuff: BuffEffect not found! " + text);
             }
         }
     }
 }
        protected virtual void OnEntityAbilityAdded(Object p_sender, EventArgs p_args)
        {
            AbilityEventArgs abilityEventArgs = (AbilityEventArgs)p_args;

            if (abilityEventArgs.Monster == MyController)
            {
                String gfx       = abilityEventArgs.Ability.StaticData.Gfx;
                String animation = abilityEventArgs.Ability.StaticData.Animation;
                if (!String.IsNullOrEmpty(animation))
                {
                    Int32 animationID = Int32.Parse(animation);
                    if (m_old)
                    {
                        m_Animation.Play(animation, -1f, 1f);
                    }
                    else if (m_animatorControl.DieState == 0)
                    {
                        m_animatorControl.AttackMagic(animationID);
                    }
                }
                if (!String.IsNullOrEmpty(gfx))
                {
                    if (gfx == "SKIP_FX")
                    {
                        return;
                    }
                    BuffFX buffFX = Helper.ResourcesLoad <BuffFX>(gfx, false);
                    if (buffFX != null)
                    {
                        buffFX = Helper.Instantiate <BuffFX>(buffFX);
                        FXQueue fxqueue = new GameObject(name + " " + buffFX.name + " FXQueue").AddComponent <FXQueue>();
                        fxqueue.SetData(new FXQueue.Entry[]
                        {
                            new FXQueue.Entry(buffFX, 0f, 0f)
                        }, 0);
                        if (abilityEventArgs.Ability.StaticData.TargetType == ETargetType.PARTY)
                        {
                            FXArgs args = new FXArgs(gameObject, FXHelper.GetPlayerEntity().gameObject, gameObject, FXHelper.GetPlayerEntity().gameObject, transform.position, transform.forward, -transform.right, FXHelper.GetPlayerEntity().transform.position, new List <GameObject>
                            {
                                FXHelper.GetPlayerEntity().gameObject
                            });
                            fxqueue.Execute(args);
                        }
                        else
                        {
                            FXArgs args2 = new FXArgs(gameObject, gameObject, gameObject, gameObject, transform.position, transform.forward, -transform.right, transform.position, new List <GameObject>
                            {
                                gameObject
                            });
                            fxqueue.Execute(args2);
                        }
                        m_Queues.Add(fxqueue);
                    }
                    else
                    {
                        Debug.LogError("OnAbilityEvent: Ability's  given GFX does not exist! " + gfx);
                    }
                }
                else
                {
                    Debug.LogWarning("OnAbilityEvent: Ability GFX is missing!");
                }
                if (abilityEventArgs.Ability.StaticData.NameKey == "MONSTER_ABILITY_EXPLOSIVE")
                {
                    DelayedEventManagerWorker delayedEventManagerWorker = new GameObject("ExplosiveHelper").AddComponent <DelayedEventManagerWorker>();
                    DontDestroyOnLoad(delayedEventManagerWorker);
                    delayedEventManagerWorker.StartCoroutine(PlayLateShakeFX(delayedEventManagerWorker.gameObject));
                    Destroy(gameObject, m_explosiveAbilityDelay);
                }
            }
        }
Exemple #3
0
 protected void OnBuffEvent(Object p_sender, EventArgs p_args)
 {
     if (IsBuffAddEventForMe(p_sender, p_args))
     {
         String text;
         String text2;
         GetBuffBaseFXPath(p_sender, p_args, out text, out text2);
         if (!String.IsNullOrEmpty(text) && !String.IsNullOrEmpty(text2))
         {
             if (text == "SKIP_FX")
             {
                 return;
             }
             String text3 = null;
             if (m_BuffAppliedBySpellMap.ContainsKey(text2))
             {
                 text3 = m_BuffAppliedBySpellMap[text2];
                 if (Helper.ResourcesLoadLinked <BuffFX>(text + text3, false) != null)
                 {
                     text += text3;
                 }
             }
             BuffFX buffFX = Helper.ResourcesLoadLinked <BuffFX>(text, false);
             if (buffFX != null)
             {
                 if (m_LastAddFrame == Time.frameCount)
                 {
                     return;
                 }
                 m_LastAddFrame = Time.frameCount;
                 if (text3 == "SPELL_FIRE_TORCHLIGHT" || text3 == "SPELL_LIGHT_ORB" || text3 == "SPELL_DARK_VISION" || text3 == "SPELL_LIGHT_ORB_LONG" || text3 == "SPELL_FIRE_TORCHLIGHT_LONG")
                 {
                     CancelAllFX();
                 }
                 else
                 {
                     CancelAllFX_butNotVisionFX();
                 }
                 buffFX = Helper.Instantiate <BuffFX>(buffFX);
                 buffFX.SetBuffRemoveCondition(BuffRemoveEventType, (Object p_RemoveEventSender, EventArgs p_RemoveEventArgs) => IsBuffRemovedByThisEvent(p_sender, p_args, p_RemoveEventSender, p_RemoveEventArgs));
                 FXQueue fxqueue = new GameObject(name + " " + buffFX.name + " FXQueue").AddComponent <FXQueue>();
                 fxqueue.SetData(new FXQueue.Entry[]
                 {
                     new FXQueue.Entry(buffFX, 0f, 0f)
                 }, 0);
                 FXArgs args = new FXArgs(gameObject, gameObject, gameObject, gameObject, Vector3.zero, transform.forward, -transform.right, Vector3.zero);
                 fxqueue.Execute(args);
                 if (text3 == "SPELL_FIRE_TORCHLIGHT" || text3 == "SPELL_LIGHT_ORB" || text3 == "SPELL_DARK_VISION" || text3 == "SPELL_LIGHT_ORB_LONG" || text3 == "SPELL_FIRE_TORCHLIGHT_LONG")
                 {
                     m_QueuesLight.Add(fxqueue);
                 }
                 else
                 {
                     m_Queues.Add(fxqueue);
                 }
             }
             else
             {
                 Debug.LogError("OnBuffEvent: buff's (" + GetBuffDebugName(p_sender, p_args) + ") given GFX does not exist! " + text);
             }
         }
         else
         {
             Debug.LogWarning(String.Concat(new String[]
             {
                 "OnBuffEvent: buff(",
                 GetBuffDebugName(p_sender, p_args),
                 ") GFX or buffKey missing! gfx='",
                 text,
                 "' buffKey='",
                 text2,
                 "'"
             }));
         }
     }
 }