public void WriteInputs(InstructionCaller instruction, IList <InstructionInput> inputs, IVariableStore caller)
        {
            foreach (var input in inputs)
            {
                if (input.Type == InstructionInputType.Reference)
                {
                    var value      = input.Reference.GetValue(caller);
                    var definition = instruction.GetInputDefinition(input);

                    value = ResolveValue(definition.Definition, value, instruction.Instruction, _invalidInputError, definition.Name);

                    if (value.Type != VariableType.Empty)
                    {
                        Input.AddVariable(input.Name, value);
                    }
                    else
                    {
                        Debug.LogWarningFormat(_missingInputError, input.Name, instruction.Instruction, input.Reference);
                    }
                }
                else if (input.Type == InstructionInputType.Value)
                {
                    Input.AddVariable(input.Name, input.Value);
                }
            }
        }
Example #2
0
 public override void GetInputs(IList <VariableDefinition> inputs)
 {
     if (Source == InstructionSource.Value)
     {
         foreach (var input in Instruction.Inputs)
         {
             if (InstructionStore.IsInput(input))
             {
                 inputs.Add(Instruction.GetInputDefinition(input));
             }
         }
     }
     else if (Source == InstructionSource.Reference)
     {
         if (InstructionStore.IsInput(Reference))
         {
             inputs.Add(new VariableDefinition {
                 Name = Reference.RootName, Definition = ValueDefinition.Create <Instruction>()
             });
         }
     }
 }