Skip to content

Set Local Variable value inside other graph

User created LBs

Set Local Variable value inside other graph

Postby Neodrop » 05 Jul 2011, 09:23

(will be included in 1.21)

Syntax:
Using csharp Syntax Highlighting
using System;
using Antares.Vizio.Runtime;
using Antares.Vizio.Runtime.Core;
using UnityEngine;
[VisualLogicBlockDescription(@"Set local variable value of the specified target graph.
NOTE : The variable name is case sensitive"
)]
    [VisualLogicBlock("Set Value For", "Variables", ParentName = "Local Variable")]
    public class SetLocalVariableBlock : LogicBlock
    {
        [Parameter(VariableType.In, typeof(VizioComponent), Name = "Target Component")]
        public Variable target;

        [Parameter(VariableType.In, typeof(string), Name = "Local Variable Name")]
        public Variable variableName;

        [Parameter(VariableType.In, typeof(object), Name = "Value")]
        public Variable variableValueIn;

        [Parameter(VariableType.Out, typeof(object), Name = "Value")]
        public Variable variableValueOut;

        public LocalVariable variableLink = null;

        [EntryTrigger("Set")]
        public void In()
        {

            if (target.Value as VizioComponent == null)
            {
                MarkAsBroken("Target Component is null");
                return;
            }

            variableLink = ((VizioComponent)target.Value).GetLocalVariableByName((string)variableName.Value);
            if (variableLink != null)
            {
                variableLink.Value = variableValueIn.Value;
                variableValueOut.Value = variableLink.Value;
                ActivateTrigger(0);
                return;
            }
            ActivateTrigger(1);
        }

        public override void OnInitializeDefaultData()
        {
            RegisterOutputTrigger("FOUND"); //0
            RegisterOutputTrigger("NOT FOUND");//1
        }
    }
 
Parsed in 0.015 seconds, using GeSHi 1.0.8.4
User avatar
Neodrop
Администратор
 
Posts: 1068
Joined: 15 Jan 2011, 13:18

Re: Set Local Variable value inside other graph

Postby Trezvie » 27 Nov 2015, 14:22

Nice posts. Keep posting such needed information. Thank's!
Trezvie
 
Posts: 13
Joined: 26 Nov 2015, 15:32


Return to Smart Blocks

Who is online

Registered users: No registered users