示例#1
0
        public int CountForInspector => booleans.CountForInspector + ints.CountForInspector;// + enumTags.CountForInspector + boolTags.CountForInspector;

#if !NO_PEGI
        public override bool Inspect()
        {
            var changed = false;


            if (icon.Next.Click("Add 1 to logic version (will cause conditions to be reevaluated)").nl())
            {
                LogicMGMT.AddLogicVersion();
            }

            foreach (var bGr in booleans)
            {
                var group = TriggerGroup.all[booleans.currentEnumerationIndex];
                foreach (var b in bGr)
                {
                    group[b].Inspect_AsInList().nl(ref changed);
                }
            }

            foreach (var iGr in ints)
            {
                var group = TriggerGroup.all[ints.currentEnumerationIndex];
                foreach (var i in iGr)
                {
                    group[iGr.currentEnumerationIndex].Inspect_AsInList().nl(ref changed);
                }
            }


            return(changed);
        }
示例#2
0
        public override bool TryForceConditionValue(Values value, bool toTrue)
        {
            if (TestFor(value) == toTrue)
            {
                return(true);
            }

            if (toTrue)
            {
                switch (type)
                {
                case ConditionType.Above:                   SetInt(value, compareValue + 1);                                                break;

                case ConditionType.Below:                   SetInt(value, compareValue - 1);                                                break;

                case ConditionType.Equals:                  SetInt(value, compareValue);                                                    break;

                case ConditionType.NotEquals:               if (GetInt(value) == compareValue)
                    {
                        value.ints[groupIndex].Add(triggerIndex, 1);
                    }
                    break;

                case ConditionType.RealTimePassedAbove:     SetInt(value, LogicMGMT.RealTimeNow() - compareValue - 1);                      break;

                case ConditionType.RealTimePassedBelow:     SetInt(value, LogicMGMT.RealTimeNow());                                         break;

                case ConditionType.VirtualTimePassedAbove:  SetInt(value, (int)Time.time - compareValue - 1);                               break;

                case ConditionType.VirtualTimePassedBelow:  SetInt(value, (int)Time.time);                                                  break;
                }
            }
            else
            {
                switch (type)
                {
                case ConditionType.Above:                   SetInt(value, compareValue - 1);                                                break;

                case ConditionType.Below:                   SetInt(value, compareValue + 1);                                                break;

                case ConditionType.Equals:                  SetInt(value, compareValue + 1);                                                break;

                case ConditionType.NotEquals:               SetInt(value, compareValue);                                                    break;

                case ConditionType.RealTimePassedAbove:     SetInt(value, LogicMGMT.RealTimeNow());                                         break;

                case ConditionType.RealTimePassedBelow:     SetInt(value, LogicMGMT.RealTimeNow() - compareValue - 1);                      break;

                case ConditionType.VirtualTimePassedAbove:  SetInt(value, (int)Time.time);                                                 break;

                case ConditionType.VirtualTimePassedBelow:  SetInt(value, (int)Time.time - compareValue - 1);                               break;
                }
            }

            LogicMGMT.currentLogicVersion++;

            return(true);
        }
示例#3
0
        public static void Apply(this List <Result> results, Values to)
        {
            if (results.Count > 0)
            {
                foreach (var r in results)
                {
                    r.Apply(to);
                }

                LogicMGMT.AddLogicVersion();
            }
        }
示例#4
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;
            }
        }
示例#5
0
        public override bool PEGI()
        {
            bool changed = false;

            current = this;

            if ("quest++".Click().nl())
            {
                LogicMGMT.AddLogicVersion();
            }

            pegi.newLine();

            "Click Enter to apply renaming.".writeOneTimeHint("EntApplyTrig");

            Trigger.Search_PEGI();

            Trigger.searchMatchesFound = 0;

            foreach (TriggerGroup td in TriggerGroup.all)
            {
                td.PEGI();
            }

            if (TriggerGroup.Browsed != null)
            {
                TriggerGroup.Browsed.AddTrigger_PEGI(null);
                TriggerGroup.Browsed.showInInspectorBrowser = true;
            }

            pegi.nl();

            changed |= base.PEGI();

            pegi.newLine();

            return(changed);
        }
示例#6
0
 public virtual void OnEnable() => inst = this;
示例#7
0
        public override bool TestFor(Values st)
        {
            int timeGap;

            switch (type)
            {
            case ConditionType.Above:                   if (GetInt(st) > compareValue)
                {
                    return(true);
                }
                break;

            case ConditionType.Below:                   if (GetInt(st) < compareValue)
                {
                    return(true);
                }
                break;

            case ConditionType.Equals:                  if (GetInt(st) == compareValue)
                {
                    return(true);
                }
                break;

            case ConditionType.NotEquals:               if (GetInt(st) != compareValue)
                {
                    return(true);
                }
                break;

            case ConditionType.VirtualTimePassedAbove:
                timeGap = (int)Time.time - GetInt(st);
                if (timeGap > compareValue)
                {
                    return(true);
                }
                LogicMGMT.inst.AddTimeListener(compareValue - timeGap);         break;

            case ConditionType.VirtualTimePassedBelow:
                timeGap = (int)Time.time - GetInt(st);
                if (timeGap < compareValue)
                {
                    LogicMGMT.inst.AddTimeListener(compareValue - timeGap);
                    return(true);
                }
                break;

            case ConditionType.RealTimePassedAbove:
                timeGap = (LogicMGMT.RealTimeNow() - GetInt(st));
                if (timeGap > compareValue)
                {
                    return(true);
                }
                LogicMGMT.inst.AddTimeListener(compareValue - timeGap);     break;

            case ConditionType.RealTimePassedBelow:
                timeGap = (LogicMGMT.RealTimeNow() - GetInt(st));
                if (timeGap < compareValue)
                {
                    LogicMGMT.inst.AddTimeListener(compareValue - timeGap);
                    return(true);
                }
                break;
            }
            return(false);
        }