Пример #1
0
        public int CountForInspector() => booleans.CountForInspector() + ints.CountForInspector();// + enumTags.CountForInspector + boolTags.CountForInspector;

        public virtual bool Inspect()
        {
            var changed = false;

            if (Application.isPlaying && icon.Refresh.Click("Add 1 to logic version (will cause conditions to be reevaluated)"))
            {
                LogicMGMT.AddLogicVersion();
            }

            pegi.nl();

            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.AddLogicVersion();

            return(true);
        }
Пример #3
0
        public static void Apply(this List <Result> results, Values to)
        {
            if (results.Count <= 0)
            {
                return;
            }

            foreach (var r in results)
            {
                r.Apply(to);
            }

            LogicMGMT.AddLogicVersion();
        }
Пример #4
0
 public override bool TryForceConditionValue(Values values, bool toTrue)
 {
     SetBool(values, toTrue ? compareValue : !compareValue);
     LogicMGMT.AddLogicVersion();
     return(true);
 }