コード例 #1
0
        protected override void OnEnter()
        {
            Variable var   = GetInput("Value");
            int      value = var.ConvertedValue <int>();

            int smallest = -1;
            Pin pin      = null;

            foreach (var w in Weights)
            {
                Variable wv     = Variables.GetByName(w.VariableName);
                int      weight = wv.ConvertedValue <int>();
                if (weight == value)
                {
                    pin = PinCollection.Get(w.OutputName);
                    break;
                }
                else if (weight > value && smallest > weight)
                {
                    pin      = PinCollection.Get(w.OutputName);
                    smallest = weight;
                }
            }
            _calculatedNextNode = pin;
            IsFinished          = true;
        }
コード例 #2
0
ファイル: Branch.cs プロジェクト: KellyeAnnora/GGJ2020
        protected override void OnEnter()
        {
            Variable input = GetInput("Condition");
            string   name  = (input.ConvertedValue <bool>()) ? "True" : "False";

            _calculatedNextNode = PinCollection.Get(name);
            IsFinished          = true;
        }
コード例 #3
0
ファイル: ToString.cs プロジェクト: KellyeAnnora/GGJ2020
        protected override void OnInit()
        {
            PinCollection.AddInput("Input", typeof(object));
            var input = PinCollection.Get("Input");

            input.IsDynamicType = true;

            PinCollection.AddOutput("Result", typeof(string));
        }
コード例 #4
0
        public void ChangeVariable(string name)
        {
            VariableName = name;
            Variable v = GetVariable();

            if (v == null)
            {
                VariableName = "";
            }

            var value = PinCollection.Get("Value");

            value.VariableType = (v != null) ? v.type : typeof(object);
            HasChanges         = true;
            Root.HasChanges    = true;
        }
コード例 #5
0
        void onInputTypeChanged(bool wasInput, bool isInput)
        {
            var pin = PinCollection.Get("Value");

            if (pin != null)
            {
                Pin.Disconnect(pin);
            }

            PinCollection.Clear();
            if (IsInput)
            {
                PinCollection.AddInput("Value", Type);
            }
            else
            {
                PinCollection.AddOutput("Value", Type);
            }
        }
コード例 #6
0
        void onInputTypeChanged(bool wasInput, bool isInput)
        {
            string removeName = (IsInput) ? "OUT" : "IN";
            var    pin        = PinCollection.Get(removeName);

            if (pin != null)
            {
                Pin.Disconnect(pin);
            }

            PinCollection.Clear();
            if (IsInput)
            {
                PinCollection.AddInTransition("IN");
            }
            else
            {
                PinCollection.AddOutTransition("OUT");
            }
        }
コード例 #7
0
        /// <summary>
        /// Changes the variable to another one.
        /// </summary>
        /// <param name="name"></param>
        public void ChangeVariable(string name)
        {
            VariableName = name;
            Variable variable = GetVariable();

            if (variable == null)
            {
                VariableName = "";
            }

            var value = PinCollection.Get("Value");

            value.VariableType = (variable != null) ? variable.type : typeof(object);

            var newValue = PinCollection.Get("NewValue");

            newValue.VariableType = (variable != null) ? variable.type : typeof(object);

            RemoveStoredVariable("NewValue");

            HasChanges      = true;
            Root.HasChanges = true;
        }
コード例 #8
0
ファイル: TextNode.cs プロジェクト: KellyeAnnora/GGJ2020
 public void SelectAnswer(string outputName)
 {
     _calculatedNextNode = PinCollection.Get(outputName);
     IsFinished          = true;
 }