public void Update()
 {
     try
     {
         Dictionary <int, Effect> dictionary = new Dictionary <int, Effect>();
         foreach (KeyValuePair <int, Effect> current in this.m_Effects)
         {
             if (current.Value.Dead)
             {
                 current.Value.Destroy();
             }
             else
             {
                 dictionary.Add(current.Key, current.Value);
             }
         }
         this.m_Effects.Clear();
         this.m_Effects = dictionary;
         foreach (KeyValuePair <int, Effect> current in this.m_Effects)
         {
             current.Value.Update();
         }
     }
     catch (Exception ex)
     {
         EffectLogger.Fatal(ex.ToString());
     }
 }
示例#2
0
 public void Update()
 {
     try
     {
         Singleton <EffectManagerImplement> .singleton.Update();
     }
     catch (Exception message)
     {
         EffectLogger.Fatal(message);
     }
 }
 public void SetVisible(int id, bool bVisible)
 {
     try
     {
         if (this.m_Effects.ContainsKey(id))
         {
             this.m_Effects[id].SetVisible(bVisible);
         }
     }
     catch (Exception ex)
     {
         EffectLogger.Fatal(ex.ToString());
     }
 }
 public void StopEffect(int id)
 {
     try
     {
         if (this.m_Effects.ContainsKey(id))
         {
             this.m_Effects[id].Destroy();
             this.m_Effects.Remove(id);
         }
     }
     catch (Exception ex)
     {
         EffectLogger.Fatal(ex.ToString());
     }
 }
        public int PlayEffect(int id, IBeast caster, IBeast target)
        {
            int num = -1;
            int result;

            try
            {
                EffectLogger.Debug("PlayEffect:" + id);
                if (!this.m_EffectDatas.ContainsKey(id))
                {
                    EffectLogger.Error("!m_EffectDatas.ContainsKey(id):" + id);
                    result = -1;
                    return(result);
                }
                EffectData effectData = this.m_EffectDatas[id];
                if (effectData == null)
                {
                    result = -1;
                    return(result);
                }
                Effect effect = new Effect();
                effect.m_nEffectTypeId = id;
                effect.Caster          = caster;
                effect.Target          = target;
                num = this.GetID();
                if (this.HighLight)
                {
                    effect.HighLight = true;
                    this.m_HightLightEffect.Add(num, effect);
                }
                effect.Load(effectData);
                if (num != -1)
                {
                    effect.Id = num;
                    this.m_Effects.Add(num, effect);
                }
            }
            catch (Exception e)
            {
                EffectLogger.Fatal(e.ToString());
            }
            result = num;
            return(result);
        }
示例#6
0
 public void Update()
 {
     try
     {
         if (this.m_Loaded)
         {
             if (this.m_Data.Life != 0f && Time.time - this.m_StartTime > this.m_Data.Life)
             {
                 this.Dead = true;
             }
             else
             {
                 this.Dead = true;
                 foreach (EffectInstance current in this.m_EffectInstances)
                 {
                     if (!current.Dead)
                     {
                         this.Dead = false;
                         break;
                     }
                 }
             }
             if (!this.Dead)
             {
                 foreach (var current in this.m_EffectInstances)
                 {
                     current.Update();
                 }
             }
         }
     }
     catch (Exception e)
     {
         EffectLogger.Fatal(e);
     }
 }
        public int PlayEffect(int id, Beast iCast, Vector3 vec3SrcPos, IXUIObject uiObjectCast,
                              Beast iTarget, Vector3 vec3DestPos, IXUIObject uiObjectTarget, Vector3 vec3FixDir)
        {
            int num = -1;

            try
            {
                if (this.m_EffectDatas.ContainsKey(id))
                {
                    EffectData effectData = this.m_EffectDatas[id];
                    if (null != effectData)
                    {
                        if (effectData.Reverse > 0)
                        {
                            if (iCast == null || null == iTarget)
                            {
                                effectData.Reverse = 0;
                            }
                        }
                        Effect effect = new Effect();
                        effect.m_nEffectTypeId = id;
                        effect.Caster          = ((effectData.Reverse == 0) ? iCast : iTarget);
                        effect.Target          = ((effectData.Reverse == 0) ? iTarget : iCast);

                        /*if (null != uiObjectCast)
                         * {
                         *  effect.CasterUIObject = SafeXUIObject.GetSafeXUIObject(uiObjectCast);
                         * }
                         * if (null != uiObjectTarget)
                         * {
                         *  effect.TargetUIObject = SafeXUIObject.GetSafeXUIObject(uiObjectTarget);
                         * }*/
                        num = this.GetID();
                        if (num != -1)
                        {
                            if (this.HighLight)
                            {
                                effect.HighLight = true;
                                this.m_HightLightEffect.Add(num, effect);
                            }
                            effect.Load(effectData);
                            effect.Id = num;
                            this.m_Effects.Add(num, effect);
                            if (vec3SrcPos != Vector3.zero)
                            {
                                if (vec3DestPos != Vector3.zero)
                                {
                                    this.m_Effects[num].SetSrcPos(vec3SrcPos);
                                }
                                else
                                {
                                    this.m_Effects[num].SourcePos = vec3SrcPos;
                                }
                            }
                            if (vec3DestPos != Vector3.zero)
                            {
                                this.m_Effects[num].TargetPos = vec3DestPos;
                            }
                            if (vec3FixDir != Vector3.zero)
                            {
                                this.m_Effects[num].FixDir = vec3FixDir;
                            }
                            EffectLogger.Debug("PlayEffect:" + id);
                        }
                    }
                }
                else
                {
                    EffectLogger.Error("!m_EffectDatas.ContainsKey(id):" + id);
                }
            }
            catch (Exception ex)
            {
                EffectLogger.Fatal(ex.ToString());
            }
            return(num);
        }