Example #1
0
        public override bool Inspect(Trigger t)
        {
            var changed = base.Inspect(t);

            Values vals = Values.current;

            //so.enumTags.Select(t);

            int value = vals.GetTagEnum(t);//[group.GetIndex()][ind];

            if (pegi.select(ref value, t.enm))
            {
                vals.SetTagEnum(t, value);
                changed = true;
            }


            pegi.newLine();

            if (Trigger.editedTrigger != t)
            {
                return(changed);
            }

            pegi.write("__ Tags __");

            const string NoZerosForTrigs = "No04t";

            pegi.newLine();
            pegi.writeOneTimeHint("Can't use 0 as tag index. ", NoZerosForTrigs);
            pegi.newLine();

            if (t.enm.edit_PEGI())
            {
                string dummy;
                if (t.enm.TryGetValue(0, out dummy))
                {
                    t.enm.Remove(0);
                    pegi.resetOneTimeHint(NoZerosForTrigs);
                }
                changed = true;
            }

            return(changed);
        }
Example #2
0
        public static void Apply(this ResultType type, int updateValue, ValueIndex dest, Values so)
        {
            switch (type)
            {
            case ResultType.SetBool: dest.SetBool(so, (updateValue > 0)); break;

            case ResultType.Set: dest.SetInt(so, updateValue); break;

            case ResultType.Add: so.ints[dest.groupIndex].Add(dest.triggerIndex, updateValue); break;

            case ResultType.Subtract: so.ints[dest.groupIndex].Add(dest.triggerIndex, -updateValue); break;

            case ResultType.SetTimeReal: dest.SetInt(so, LogicMGMT.RealTimeNow()); break;

            case ResultType.SetTimeGame: dest.SetInt(so, (int)Time.time); break;

            case ResultType.SetTagBool: so.SetTagBool(dest.groupIndex, dest.triggerIndex, updateValue > 0); break;

            case ResultType.SetTagInt: so.SetTagEnum(dest.groupIndex, dest.triggerIndex, updateValue); break;
            }
        }