Example #1
0
        public void RemoveStatusEffect(StatusEffect.Type statusEffectType, bool informCallbacks = true)
        {
            this.RequireInit();

            List <string> candidatesID    = new List <string>();
            List <string> candidatesNames = new List <string>();

            foreach (KeyValuePair <string, RuntimeStefData> stef in this.runtimeStefsData)
            {
                if (stef.Value.statusEffect.statusEffect.type == statusEffectType)
                {
                    candidatesID.Add(stef.Key);
                    candidatesNames.Add(stef.Value.statusEffect.statusEffect.uniqueName);
                }
            }

            foreach (string candidate in candidatesID)
            {
                while (this.runtimeStefsData[candidate].listStatus.Count > 0)
                {
                    this.runtimeStefsData[candidate].listStatus[0].OnEnd(gameObject);
                    this.runtimeStefsData[candidate].listStatus.RemoveAt(0);
                }
            }

            if (informCallbacks && this.onChangeStef != null)
            {
                foreach (string candidateName in candidatesNames)
                {
                    this.onChangeStef.Invoke(new EventArgs(
                                                 candidateName, EventArgs.Operation.Remove
                                                 ));
                }
            }
        }
Example #2
0
        private List <string> GetStatusEffects(bool useType, StatusEffect.Type type)
        {
            this.RequireInit();
            List <string> result = new List <string>();

            foreach (KeyValuePair <string, RuntimeStefData> item in this.runtimeStefsData)
            {
                if (item.Value.listStatus.Count > 0)
                {
                    if (!useType || item.Value.statusEffect.statusEffect.type == type)
                    {
                        result.Add(item.Key);
                    }
                }
            }

            return(result);
        }
Example #3
0
 public List <string> GetStatusEffects(StatusEffect.Type type)
 {
     return(this.GetStatusEffects(true, type));
 }