Пример #1
0
        public void RemoveStatusEffect(StatusEffectAsset statusEffect, bool informCallbacks = true)
        {
            if (!statusEffect)
            {
                return;
            }

            this.RequireInit();

            if (!this.runtimeStefsData.ContainsKey(statusEffect.uniqueID))
            {
                return;
            }
            if (this.runtimeStefsData[statusEffect.uniqueID].listStatus.Count <= 0)
            {
                return;
            }

            this.runtimeStefsData[statusEffect.uniqueID].listStatus[0].OnEnd(gameObject);
            this.runtimeStefsData[statusEffect.uniqueID].listStatus.RemoveAt(0);

            if (informCallbacks && this.onChangeStef != null)
            {
                this.onChangeStef.Invoke(new EventArgs(
                                             statusEffect.statusEffect.uniqueName, EventArgs.Operation.Remove
                                             ));
            }
        }
Пример #2
0
        // PUBLIC STATUS EFFECT METHODS: ----------------------------------------------------------

        public void AddStatusEffect(StatusEffectAsset statusEffect, bool informCallbacks = true)
        {
            if (!statusEffect)
            {
                return;
            }

            this.RequireInit();
            if (!this.runtimeStefsData.ContainsKey(statusEffect.uniqueID))
            {
                RuntimeStefData data = new RuntimeStefData(statusEffect);
                this.runtimeStefsData.Add(statusEffect.uniqueID, data);
            }

            int currentStack = this.runtimeStefsData[statusEffect.uniqueID].listStatus.Count;

            if (currentStack >= statusEffect.statusEffect.maxStack)
            {
                this.RemoveStatusEffect(statusEffect);
            }

            StatusEffect.Runtime item = new StatusEffect.Runtime(
                Time.time, statusEffect.statusEffect
                );

            this.runtimeStefsData[statusEffect.uniqueID].listStatus.Add(item);
            item.OnStart(gameObject);

            if (informCallbacks && this.onChangeStef != null)
            {
                this.onChangeStef.Invoke(new EventArgs(
                                             statusEffect.statusEffect.uniqueName, EventArgs.Operation.Add
                                             ));
            }
        }
        public static StatusEffectAsset AddStatusEffectAsset()
        {
            StatusEffectAsset statusEffectAsset = ScriptableObject.CreateInstance <StatusEffectAsset>();

            statusEffectAsset.name = GameCreatorUtilities.RandomHash(8);

            string path = Path.Combine(ASSETS_PATH, STAEFASSET_FILE);

            AssetDatabase.AddObjectToAsset(statusEffectAsset, path);

            return(statusEffectAsset);
        }
Пример #4
0
            public RuntimeStefData(string uniqueID, float[] timeStack)
            {
                this.listStatus   = new List <StatusEffect.Runtime>();
                this.statusEffect = DatabaseStats.Load().GetStatusEffect(uniqueID);

                for (int i = 0; i < timeStack.Length; ++i)
                {
                    this.listStatus.Add(new StatusEffect.Runtime(
                                            timeStack[i], this.statusEffect.statusEffect
                                            ));
                }
            }
Пример #5
0
        public bool HasStatusEffect(StatusEffectAsset statusEffect, int amount = 1)
        {
            this.RequireInit();
            if (!statusEffect)
            {
                return(false);
            }

            return(
                this.runtimeStefsData.ContainsKey(statusEffect.uniqueID) &&
                this.runtimeStefsData[statusEffect.uniqueID].listStatus.Count >= amount
                );
        }
Пример #6
0
 public RuntimeStefData(StatusEffectAsset statusEffect)
 {
     this.listStatus   = new List <StatusEffect.Runtime>();
     this.statusEffect = statusEffect;
 }