Пример #1
0
 public void Init()
 {
     hp        = this[ZRSetting.HP, true];
     cage      = this[ZRSetting.Cage, true];
     reduction = this[ZRSetting.Reduction, true];
     speed     = this[ZRSetting.Speed, true];
 }
Пример #2
0
    public void Koef(ZRSettings sets)
    {
        for (int i = 0; i < count; i++)
        {
            if (!sets.names.Contains(this.names[i]))
            {
                continue;
            }
            ZRValue val = this.values[i];

            val.current += val.max * sets[this.names[i]].percent;
            //Debug.Log(this.names[i] + ":" + sets[this.names[i]].percent + ": " + sets[this.names[i]]);
            if (val.peaked)
            {
                val.Refresh();
            }
            if (val.minimum)
            {
                val.Reset();
            }
            if (this.names[i] == ZRSetting.Cage)
            {
                val.current = (int)val.current;
                //Debug.Log(val.ToString());
            }
        }
        Init();
    }
Пример #3
0
    public void Addition(ZRSettings sets)
    {
        for (int i = 0; i < count; i++)
        {
            if (sets.names.Contains(this.names[i]))
            {
                ZRValue val = this.values[i] * sets[this.names[i]].percent;

                if (this.names[i] == ZRSetting.Cage)
                {
                    val.ToInt();
                }
                this.values[i] += val;
            }
        }
        Init();
    }
Пример #4
0
    public ZRValue this[ZRSetting _name, bool init = false]
    {
        get
        {
            if (!init)
            {
                switch (_name)
                {
                case ZRSetting.HP:
                    return(hp);

                case ZRSetting.Cage:
                    return(cage);

                case ZRSetting.Reduction:
                    return(reduction);

                case ZRSetting.Speed:
                    return(speed);
                }
            }

            if (!Contains(_name))
            {
                return(new ZRValue(0));
            }

            return(values[(names.IndexOf(_name))]);
        }
        set
        {
            if (!init)
            {
                switch (_name)
                {
                case ZRSetting.HP:
                    hp = value;
                    return;

                case ZRSetting.Cage:
                    cage = value;
                    return;

                case ZRSetting.Reduction:
                    reduction = value;
                    return;

                case ZRSetting.Speed:
                    speed = value;
                    return;
                }
            }
            if (!names.Contains(_name))
            {
                Add(_name, value);
            }
            if (value != null)
            {
                values[(names.IndexOf(_name))] = value;
            }
            else
            {
                Remove(_name);
            }
        }
    }
Пример #5
0
 public void Add(ZRSetting _name, ZRValue _value)
 {
     names.Add(_name);
     values.Add(_value);
     Init();
 }