protected internal override VariableValue Cast_(VariableValue owner, string type)
 {
     if (type == _gameObjectName)
     {
         var gameObject = ComponentHelper.GetAsGameObject(owner.Object);
         return(VariableValue.Create(gameObject));
     }
     else
     {
         var component = ComponentHelper.GetAsComponent(owner.Object, type);
         return(VariableValue.Create(component));
     }
 }
 protected internal override bool Test_(VariableValue owner, string type)
 {
     if (type == _gameObjectName)
     {
         var gameObject = ComponentHelper.GetAsGameObject(owner.Object);
         return(gameObject != null);
     }
     else
     {
         var component = ComponentHelper.GetAsComponent(owner.Object, type);
         return(component != null);
     }
 }
Example #3
0
        private VariableValue GetValue(IVariableStore variables, int index)
        {
            var variable = _variable[index];
            var lookup   = _lookups[index];

            var value = variables.GetVariable(variable);

            if (!string.IsNullOrEmpty(lookup) && value.Type == VariableType.Object)
            {
                if (lookup == _gameObjectName)
                {
                    var obj = ComponentHelper.GetAsGameObject(value.Object);
                    value = obj != null?VariableValue.Create(obj) : VariableValue.Empty;
                }
                else
                {
                    var component = ComponentHelper.GetAsComponent(value.Object, lookup);
                    value = component != null?VariableValue.Create(component) : VariableValue.Empty;
                }
            }

            return(value);
        }