Exemplo n.º 1
0
        // OVERRIDERS: ----------------------------------------------------------------------------

        protected override GUIContent[] GetVariables(int allowTypesMask)
        {
            if (this.target == null)
            {
                return(new GUIContent[0]);
            }
            LocalVariables[] localVariables = LocalVariablesUtilities.GatherLocals(
                this.target, this.inChildren
                );

            List <GUIContent> variables = new List <GUIContent>();

            for (int i = 0; i < localVariables.Length; ++i)
            {
                LocalVariables local = localVariables[i];
                for (int j = 0; j < local.references.Length; ++j)
                {
                    Variable.DataType type = (Variable.DataType)local.references[j].variable.type;
                    if ((allowTypesMask & 1 << (int)type) == 0)
                    {
                        continue;
                    }

                    variables.Add(new GUIContent(
                                      " " + local.references[j].variable.name,
                                      VariableEditorUtils.GetIcon(type)
                                      ));
                }
            }

            return(variables.ToArray());
        }
Exemplo n.º 2
0
 public override Variable GetRuntimeVariable()
 {
     return(LocalVariablesUtilities.Get(
                ((MBVariable)this.target).gameObject,
                this.spVariableName.stringValue,
                false
                ));
 }
Exemplo n.º 3
0
        public static Variable.DataType GetLocalType(GameObject target, string name, bool inChildren = false)
        {
            Variable variable = LocalVariablesUtilities.Get(target, name, inChildren);

            return(variable != null
                ? (Variable.DataType)variable.type
                : Variable.DataType.Null
                   );
        }
Exemplo n.º 4
0
        public static void SetLocal(GameObject target, string name, object value, bool inChildren = false)
        {
            Variable variable = LocalVariablesUtilities.Get(target, name, inChildren);

            if (variable != null)
            {
                variable.Update(value);
                VariablesManager.events.OnChangeLocal(target, name);
            }
        }
Exemplo n.º 5
0
        public static object GetLocal(GameObject target, string name, bool inChildren = false)
        {
            Variable variable = LocalVariablesUtilities.Get(target, name, inChildren);

            return(variable != null ? variable.Get() : null);
        }