public SendMessageUpwards ( string methodName ) : void | ||
methodName | string | |
Результат | void |
private void Press(Vector2 screenPos) { lastGo = RaycastObject(screenPos); if (lastGo != null) { lastGo.SendMessageUpwards("OnPress", SendMessageOptions.DontRequireReceiver); } }
void Attack(GameObject go) { PlayerAI player = go.GetComponent ("PlayerAI") as PlayerAI; this.health -= player.strength; if (health <= 0.1) { go.SendMessageUpwards("killed", this.gameObject); Destroy(this.gameObject); } }
static public int SendMessageUpwards(IntPtr l) { try { int argc = LuaDLL.lua_gettop(l); if (argc == 2) { UnityEngine.GameObject self = (UnityEngine.GameObject)checkSelf(l); System.String a1; checkType(l, 2, out a1); self.SendMessageUpwards(a1); pushValue(l, true); return(1); } else if (matchType(l, argc, 2, typeof(string), typeof(System.Object))) { UnityEngine.GameObject self = (UnityEngine.GameObject)checkSelf(l); System.String a1; checkType(l, 2, out a1); System.Object a2; checkType(l, 3, out a2); self.SendMessageUpwards(a1, a2); pushValue(l, true); return(1); } else if (matchType(l, argc, 2, typeof(string), typeof(UnityEngine.SendMessageOptions))) { UnityEngine.GameObject self = (UnityEngine.GameObject)checkSelf(l); System.String a1; checkType(l, 2, out a1); UnityEngine.SendMessageOptions a2; checkEnum(l, 3, out a2); self.SendMessageUpwards(a1, a2); pushValue(l, true); return(1); } else if (argc == 4) { UnityEngine.GameObject self = (UnityEngine.GameObject)checkSelf(l); System.String a1; checkType(l, 2, out a1); System.Object a2; checkType(l, 3, out a2); UnityEngine.SendMessageOptions a3; checkEnum(l, 4, out a3); self.SendMessageUpwards(a1, a2, a3); pushValue(l, true); return(1); } pushValue(l, false); LuaDLL.lua_pushstring(l, "No matched override function to call"); return(2); } catch (Exception e) { return(error(l, e)); } }
void attackObject(GameObject go, Vector3 direction, float distance) { timeToChangeMoveDirection = changeInterval; moveDirection = direction; timeBetweenAttacks -= Time.deltaTime; if (distance < 1 && timeBetweenAttacks <= 0) { timeBetweenAttacks = 1.0f; go.SendMessageUpwards ("Attack", this.gameObject); } }
static public int SendMessageUpwards(IntPtr l) { try{ if (matchType(l, 2, typeof(System.String), typeof(System.Object), typeof(UnityEngine.SendMessageOptions))) { UnityEngine.GameObject self = (UnityEngine.GameObject)checkSelf(l); System.String a1; checkType(l, 2, out a1); System.Object a2; checkType(l, 3, out a2); UnityEngine.SendMessageOptions a3; checkEnum(l, 4, out a3); self.SendMessageUpwards(a1, a2, a3); return(0); } else if (matchType(l, 2, typeof(System.String), typeof(System.Object))) { UnityEngine.GameObject self = (UnityEngine.GameObject)checkSelf(l); System.String a1; checkType(l, 2, out a1); System.Object a2; checkType(l, 3, out a2); self.SendMessageUpwards(a1, a2); return(0); } else if (matchType(l, 2, typeof(System.String))) { UnityEngine.GameObject self = (UnityEngine.GameObject)checkSelf(l); System.String a1; checkType(l, 2, out a1); self.SendMessageUpwards(a1); return(0); } else if (matchType(l, 2, typeof(System.String), typeof(UnityEngine.SendMessageOptions))) { UnityEngine.GameObject self = (UnityEngine.GameObject)checkSelf(l); System.String a1; checkType(l, 2, out a1); UnityEngine.SendMessageOptions a2; checkEnum(l, 3, out a2); self.SendMessageUpwards(a1, a2); return(0); } LuaDLL.luaL_error(l, "No matched override function to call"); return(0); } catch (Exception e) { LuaDLL.luaL_error(l, e.ToString()); return(0); } }
static public int SendMessageUpwards__String(IntPtr l) { try { UnityEngine.GameObject self = (UnityEngine.GameObject)checkSelf(l); System.String a1; checkType(l, 2, out a1); self.SendMessageUpwards(a1); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
public static int SendMessageUpwards2_wrap(long L) { try { long nThisPtr = FCLibHelper.fc_get_inport_obj_ptr(L); UnityEngine.GameObject obj = get_obj(nThisPtr); string arg0 = FCLibHelper.fc_get_string_a(L, 0); obj.SendMessageUpwards(arg0); } catch (Exception e) { Debug.LogException(e); } return(0); }
static int SendMessageUpwards(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.GameObject), typeof(string))) { UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.ToObject(L, 1); string arg0 = ToLua.ToString(L, 2); obj.SendMessageUpwards(arg0); return(0); } else if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.GameObject), typeof(string), typeof(UnityEngine.SendMessageOptions))) { UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.ToObject(L, 1); string arg0 = ToLua.ToString(L, 2); UnityEngine.SendMessageOptions arg1 = (UnityEngine.SendMessageOptions)ToLua.ToObject(L, 3); obj.SendMessageUpwards(arg0, arg1); return(0); } else if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.GameObject), typeof(string), typeof(object))) { UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.ToObject(L, 1); string arg0 = ToLua.ToString(L, 2); object arg1 = ToLua.ToVarObject(L, 3); obj.SendMessageUpwards(arg0, arg1); return(0); } else if (count == 4 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.GameObject), typeof(string), typeof(object), typeof(UnityEngine.SendMessageOptions))) { UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.ToObject(L, 1); string arg0 = ToLua.ToString(L, 2); object arg1 = ToLua.ToVarObject(L, 3); UnityEngine.SendMessageOptions arg2 = (UnityEngine.SendMessageOptions)ToLua.ToObject(L, 4); obj.SendMessageUpwards(arg0, arg1, arg2); return(0); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.GameObject.SendMessageUpwards")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
public static int SendMessageUpwards1_wrap(long L) { try { long nThisPtr = FCLibHelper.fc_get_inport_obj_ptr(L); UnityEngine.GameObject obj = get_obj(nThisPtr); string arg0 = FCLibHelper.fc_get_string_a(L, 0); System.Object arg1 = FCGetObj.GetSystemObj(FCLibHelper.fc_get_param_ptr(L, 1)); obj.SendMessageUpwards(arg0, arg1); } catch (Exception e) { Debug.LogException(e); } return(0); }
static public int SendMessageUpwards__String__Object__SendMessageOptions(IntPtr l) { try { UnityEngine.GameObject self = (UnityEngine.GameObject)checkSelf(l); System.String a1; checkType(l, 2, out a1); System.Object a2; checkType(l, 3, out a2); UnityEngine.SendMessageOptions a3; checkEnum(l, 4, out a3); self.SendMessageUpwards(a1, a2, a3); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
// Update is called once per frame void Update() { if (!Activated) { return; } Ray ray = new Ray(transform.position, transform.right); RaycastHit hit; if (Physics.Raycast(ray, out hit, maxDistance)) { lineRenderer.SetPosition(1, new Vector3(hit.distance, 0, 0)); Debug.DrawLine(transform.position, hit.point); if (currentTarget != hit.collider.gameObject) { currentTarget = hit.collider.gameObject; currentTarget.SendMessageUpwards("Hit", killTime, SendMessageOptions.DontRequireReceiver); if (currentTarget.transform.tag.Equals("Player")) { audioBeamContact.Play(); } } } }
void RaiseEvent(MessageName msg) { if (interaction == InteractionType.Event) { if (!useBroadcast) { switch (msg) { case MessageName.On_ButtonDown: if (On_ButtonDown != null) { On_ButtonDown(gameObject.name); } break; case MessageName.On_ButtonUp: if (On_ButtonUp != null) { On_ButtonUp(gameObject.name); } break; case MessageName.On_ButtonPress: if (On_ButtonPress != null) { On_ButtonPress(gameObject.name); } break; } } else { string method = msg.ToString(); if (msg == MessageName.On_ButtonDown && downMethodName != "" && useSpecificalMethod) { method = downMethodName; } if (msg == MessageName.On_ButtonPress && pressMethodName != "" && useSpecificalMethod) { method = pressMethodName; } if (msg == MessageName.On_ButtonUp && upMethodName != "" && useSpecificalMethod) { method = upMethodName; } if (receiverGameObject != null) { switch (messageMode) { case Broadcast.BroadcastMessage: receiverGameObject.BroadcastMessage(method, name, SendMessageOptions.DontRequireReceiver); break; case Broadcast.SendMessage: receiverGameObject.SendMessage(method, name, SendMessageOptions.DontRequireReceiver); break; case Broadcast.SendMessageUpwards: receiverGameObject.SendMessageUpwards(method, name, SendMessageOptions.DontRequireReceiver); break; } } else { Debug.LogError("Button : " + gameObject.name + " : you must setup receiver gameobject"); } } } }
void sendAction(GameObject target) { Debug.Log (target.name); target.SendMessageUpwards ("Interaction"); }
static int SendMessageUpwards(IntPtr L) { IntPtr L0 = LuaException.L; try { ++LuaException.SendMsgCount; LuaException.L = L; int count = LuaDLL.lua_gettop(L); if (count == 2 && TypeChecker.CheckTypes <string>(L, 2)) { UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject)); string arg0 = ToLua.ToString(L, 2); obj.SendMessageUpwards(arg0); if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1))) { string error = LuaDLL.lua_tostring(L, -1); LuaDLL.lua_pop(L, 1); throw new LuaException(error, LuaException.GetLastError()); } --LuaException.SendMsgCount; LuaException.L = L0; return(0); } else if (count == 3 && TypeChecker.CheckTypes <string, UnityEngine.SendMessageOptions>(L, 2)) { UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject)); string arg0 = ToLua.ToString(L, 2); UnityEngine.SendMessageOptions arg1 = (UnityEngine.SendMessageOptions)ToLua.ToObject(L, 3); obj.SendMessageUpwards(arg0, arg1); if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1))) { string error = LuaDLL.lua_tostring(L, -1); LuaDLL.lua_pop(L, 1); throw new LuaException(error, LuaException.GetLastError()); } --LuaException.SendMsgCount; LuaException.L = L0; return(0); } else if (count == 3 && TypeChecker.CheckTypes <string, object>(L, 2)) { UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject)); string arg0 = ToLua.ToString(L, 2); object arg1 = ToLua.ToVarObject(L, 3); obj.SendMessageUpwards(arg0, arg1); if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1))) { string error = LuaDLL.lua_tostring(L, -1); LuaDLL.lua_pop(L, 1); throw new LuaException(error, LuaException.GetLastError()); } --LuaException.SendMsgCount; LuaException.L = L0; return(0); } else if (count == 4 && TypeChecker.CheckTypes <string, object, UnityEngine.SendMessageOptions>(L, 2)) { UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject)); string arg0 = ToLua.ToString(L, 2); object arg1 = ToLua.ToVarObject(L, 3); UnityEngine.SendMessageOptions arg2 = (UnityEngine.SendMessageOptions)ToLua.ToObject(L, 4); obj.SendMessageUpwards(arg0, arg1, arg2); if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1))) { string error = LuaDLL.lua_tostring(L, -1); LuaDLL.lua_pop(L, 1); throw new LuaException(error, LuaException.GetLastError()); } --LuaException.SendMsgCount; LuaException.L = L0; return(0); } else { --LuaException.SendMsgCount; LuaException.L = L0; return(LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.GameObject.SendMessageUpwards")); } } catch (Exception e) { --LuaException.SendMsgCount; LuaException.L = L0; return(LuaDLL.toluaL_exception(L, e)); } }
// Update is called once per frame void Update() { //raycast hits object fwd = mainCamera.transform.TransformDirection (Vector3.forward); if (gazeTarget == null && Physics.Raycast (mainCamera.transform.position, fwd, out hit, 100) && hit.collider.tag == "GazeAware" && hit.collider != GetComponent<Collider>()) { gazeTarget = hit.collider.gameObject; gazeTarget.SendMessageUpwards ("LookedAt"); gazeTarget.SendMessageUpwards ("AttachGazeController", this); } else if (gazeTarget != null && Physics.Raycast (mainCamera.transform.position, fwd, out hit, 100) && hit.collider.gameObject.name == gazeTarget.name) { gazeTarget.SendMessageUpwards ("LookedAt"); } // print ("Gazing " + gazeTarget != null); }
static int QPYX_SendMessageUpwards_YXQP(IntPtr L_YXQP) { IntPtr L0_YXQP = LuaException.L; try { ++LuaException.SendMsgCount; LuaException.L = L_YXQP; int QPYX_count_YXQP = LuaDLL.lua_gettop(L_YXQP); if (QPYX_count_YXQP == 2 && TypeChecker.CheckTypes <string>(L_YXQP, 2)) { UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L_YXQP, 1, typeof(UnityEngine.GameObject)); string QPYX_arg0_YXQP = ToLua.ToString(L_YXQP, 2); obj.SendMessageUpwards(QPYX_arg0_YXQP); if (LuaDLL.lua_toboolean(L_YXQP, LuaDLL.lua_upvalueindex(1))) { string error = LuaDLL.lua_tostring(L_YXQP, -1); LuaDLL.lua_pop(L_YXQP, 1); throw new LuaException(error, LuaException.GetLastError()); } --LuaException.SendMsgCount; LuaException.L = L0_YXQP; return(0); } else if (QPYX_count_YXQP == 3 && TypeChecker.CheckTypes <string, UnityEngine.SendMessageOptions>(L_YXQP, 2)) { UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L_YXQP, 1, typeof(UnityEngine.GameObject)); string QPYX_arg0_YXQP = ToLua.ToString(L_YXQP, 2); UnityEngine.SendMessageOptions QPYX_arg1_YXQP = (UnityEngine.SendMessageOptions)ToLua.ToObject(L_YXQP, 3); obj.SendMessageUpwards(QPYX_arg0_YXQP, QPYX_arg1_YXQP); if (LuaDLL.lua_toboolean(L_YXQP, LuaDLL.lua_upvalueindex(1))) { string error = LuaDLL.lua_tostring(L_YXQP, -1); LuaDLL.lua_pop(L_YXQP, 1); throw new LuaException(error, LuaException.GetLastError()); } --LuaException.SendMsgCount; LuaException.L = L0_YXQP; return(0); } else if (QPYX_count_YXQP == 3 && TypeChecker.CheckTypes <string, object>(L_YXQP, 2)) { UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L_YXQP, 1, typeof(UnityEngine.GameObject)); string QPYX_arg0_YXQP = ToLua.ToString(L_YXQP, 2); object QPYX_arg1_YXQP = ToLua.ToVarObject(L_YXQP, 3); obj.SendMessageUpwards(QPYX_arg0_YXQP, QPYX_arg1_YXQP); if (LuaDLL.lua_toboolean(L_YXQP, LuaDLL.lua_upvalueindex(1))) { string error = LuaDLL.lua_tostring(L_YXQP, -1); LuaDLL.lua_pop(L_YXQP, 1); throw new LuaException(error, LuaException.GetLastError()); } --LuaException.SendMsgCount; LuaException.L = L0_YXQP; return(0); } else if (QPYX_count_YXQP == 4 && TypeChecker.CheckTypes <string, object, UnityEngine.SendMessageOptions>(L_YXQP, 2)) { UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L_YXQP, 1, typeof(UnityEngine.GameObject)); string QPYX_arg0_YXQP = ToLua.ToString(L_YXQP, 2); object QPYX_arg1_YXQP = ToLua.ToVarObject(L_YXQP, 3); UnityEngine.SendMessageOptions QPYX_arg2_YXQP = (UnityEngine.SendMessageOptions)ToLua.ToObject(L_YXQP, 4); obj.SendMessageUpwards(QPYX_arg0_YXQP, QPYX_arg1_YXQP, QPYX_arg2_YXQP); if (LuaDLL.lua_toboolean(L_YXQP, LuaDLL.lua_upvalueindex(1))) { string error = LuaDLL.lua_tostring(L_YXQP, -1); LuaDLL.lua_pop(L_YXQP, 1); throw new LuaException(error, LuaException.GetLastError()); } --LuaException.SendMsgCount; LuaException.L = L0_YXQP; return(0); } else { --LuaException.SendMsgCount; LuaException.L = L0_YXQP; return(LuaDLL.luaL_throw(L_YXQP, "invalid arguments to method: UnityEngine.GameObject.SendMessageUpwards")); } } catch (Exception e) { --LuaException.SendMsgCount; LuaException.L = L0_YXQP; return(LuaDLL.toluaL_exception(L_YXQP, e)); } }
public void BroadcastUpwards(GameObject sender, GameObject receipient) { Assert.Test(receipient); this.sender = sender; receipient.SendMessageUpwards(string.Format(format, name), this, requireReceiver ? SendMessageOptions.RequireReceiver : SendMessageOptions.DontRequireReceiver); }
static public int SendMessageUpwards(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif int argc = LuaDLL.lua_gettop(l); if (argc == 2) { UnityEngine.GameObject self = (UnityEngine.GameObject)checkSelf(l); System.String a1; checkType(l, 2, out a1); self.SendMessageUpwards(a1); pushValue(l, true); return(1); } else if (matchType(l, argc, 2, typeof(string), typeof(UnityEngine.SendMessageOptions))) { UnityEngine.GameObject self = (UnityEngine.GameObject)checkSelf(l); System.String a1; checkType(l, 2, out a1); UnityEngine.SendMessageOptions a2; a2 = (UnityEngine.SendMessageOptions)LuaDLL.luaL_checkinteger(l, 3); self.SendMessageUpwards(a1, a2); pushValue(l, true); return(1); } else if (matchType(l, argc, 2, typeof(string), typeof(System.Object))) { UnityEngine.GameObject self = (UnityEngine.GameObject)checkSelf(l); System.String a1; checkType(l, 2, out a1); System.Object a2; checkType(l, 3, out a2); self.SendMessageUpwards(a1, a2); pushValue(l, true); return(1); } else if (argc == 4) { UnityEngine.GameObject self = (UnityEngine.GameObject)checkSelf(l); System.String a1; checkType(l, 2, out a1); System.Object a2; checkType(l, 3, out a2); UnityEngine.SendMessageOptions a3; a3 = (UnityEngine.SendMessageOptions)LuaDLL.luaL_checkinteger(l, 4); self.SendMessageUpwards(a1, a2, a3); pushValue(l, true); return(1); } pushValue(l, false); LuaDLL.lua_pushstring(l, "No matched override function SendMessageUpwards to call"); return(2); } catch (Exception e) { return(error(l, e)); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif }
void DoSendMessage(GameObject go) { switch (delivery) { case MessageType.SendMessage: switch (functionCall.ParameterType) { case "None": go.SendMessage(functionCall.FunctionName, options); return; case "int": go.SendMessage(functionCall.FunctionName, functionCall.IntParameter.Value, options); return; case "float": go.SendMessage(functionCall.FunctionName, functionCall.FloatParameter.Value, options); return; case "string": go.SendMessage(functionCall.FunctionName, functionCall.StringParameter.Value, options); return; case "GameObject": go.SendMessage(functionCall.FunctionName, functionCall.GameObjectParameter.Value, options); return; case "Object": go.SendMessage(functionCall.FunctionName, functionCall.ObjectReferenceParameter, options); return; } return; case MessageType.SendMessageUpwards: switch (functionCall.ParameterType) { case "None": go.SendMessageUpwards(functionCall.FunctionName, options); return; case "int": go.SendMessageUpwards(functionCall.FunctionName, functionCall.IntParameter.Value, options); return; case "float": go.SendMessageUpwards(functionCall.FunctionName, functionCall.FloatParameter.Value, options); return; case "string": go.SendMessageUpwards(functionCall.FunctionName, functionCall.StringParameter.Value, options); return; case "GameObject": go.SendMessage(functionCall.FunctionName, functionCall.GameObjectParameter.Value, options); return; case "Object": go.SendMessageUpwards(functionCall.FunctionName, functionCall.ObjectReferenceParameter, options); return; } return; case MessageType.BroadcastMessage: switch (functionCall.ParameterType) { case "None": go.BroadcastMessage(functionCall.FunctionName, options); return; case "int": go.BroadcastMessage(functionCall.FunctionName, functionCall.IntParameter.Value, options); return; case "float": go.BroadcastMessage(functionCall.FunctionName, functionCall.FloatParameter.Value, options); return; case "string": go.BroadcastMessage(functionCall.FunctionName, functionCall.StringParameter.Value, options); return; case "GameObject": go.SendMessage(functionCall.FunctionName, functionCall.GameObjectParameter.Value, options); return; case "Object": go.BroadcastMessage(functionCall.FunctionName, functionCall.ObjectReferenceParameter, options); return; } return; } }