/// <summary> /// Invoked when a script wants to set the value of a member of this object. /// </summary> /// <param name="thread">Script thread that invoked this function.</param> /// <param name="variable">Symbol describing the member that it wants set.</param> /// <param name="value">Value it wants the member to be set to.</param> /// <returns>True if successfull or false if not.</returns> public override bool GetMember(ScriptThread thread, VariableSymbol variable) { if (_nativeObject is ScriptedEntityNode) { // Check the script process is valid. ScriptProcess process = ((ScriptedEntityNode)_nativeObject).ScriptProcess; if (process == null) return false; // See if we can get the symbol they are after. VariableSymbol processSymbol = process.GetSymbol(variable.Identifier, SymbolType.Variable) as VariableSymbol; if (processSymbol == null) return false; // Grab the variable runtime value. (This can probably be optimized). RuntimeValue runtimeValue= process[0].GetRuntimeValueGlobal(processSymbol.Identifier); // Check its public. if (processSymbol.AccessModifier != SymbolAccessModifier.Public) return false; // Check data types are correct. if (variable.DataType != processSymbol.DataType) return false; // Copy value into calling thread. if (variable.DataType.IsArray == true) { thread.Registers[(int)Register.Return].MemoryIndex = (short)thread.CopyValueArrayFromThread(runtimeValue, thread, process[0]); } else thread.Registers[(int)Register.Return] = thread.CopyValueFromThread(runtimeValue, thread, process[0]); // Set the return register to our newly copied value. // Return. return true; } else if (_nativeObject is EntityNode) { } else if (_nativeObject is EmitterNode) { } else if (_nativeObject is TilemapSegmentNode) { } else if ((_nativeObject as SceneNode) != null) { } return false; }