public SendMessage ( string methodName ) : void | ||
methodName | string | |
return | void |
void Update() { if (Input.touchCount > 0) { ray = Camera.main.ScreenPointToRay(Input.GetTouch(0).position); touchPos = ray.origin; if (Physics.Raycast(ray, out rHit, 100, enemyMask)) { reciever = rHit.collider.gameObject; switch (Input.GetTouch(0).phase) { case TouchPhase.Began: reciever.SendMessage("touchStart", SendMessageOptions.DontRequireReceiver); break; case TouchPhase.Ended: reciever.SendMessage("touchUp", SendMessageOptions.DontRequireReceiver); break; case TouchPhase.Canceled: reciever.SendMessage("touchExit", SendMessageOptions.DontRequireReceiver); break; } Debug.Log("raycast hit with enemy"); Debug.DrawRay(ray.origin, ray.direction); } } }
void Update() { curTime += Time.deltaTime; if(curTime > destroyTime){ Object.Destroy(gameObject); } Collider[] enemyArray = Physics.OverlapSphere(transform.position, radius, mask); if(enemyArray.Length > 0) { for(int i = 0; i < enemyArray.Length; i++) { targetEnemy = enemyArray[i].gameObject; if(targetEnemy.transform.name.IndexOf("Enemy_Car") != -1) { targetEnemy.SendMessage("InfectCollision", 100); } else { targetEnemy.SendMessage("BulletCollision", bulletDamage); } GameObject instance = Instantiate(explosion, transform.position, transform.rotation) as GameObject; //instance.SendMessage("igniteFire"); //if(instance.rigidbody){ // instance.SendMessage("igniteFire"); //} Object.Destroy(gameObject); } } }
// Use this for initialization void Start () { // Create gravity field and gravity effect gravityField_ = Instantiate(Resources.Load("GravityField")) as GameObject; inGravityEffect_ = Instantiate(Resources.Load(tag + "InGravityEffect")) as GameObject; outGravityEffect_ = Instantiate(Resources.Load(tag + "OutGravityEffect")) as GameObject; inGravityEffect_.transform.position = gameObject.transform.position; inGravityEffect_.transform.parent = gameObject.transform; outGravityEffect_.transform.position = gameObject.transform.position; outGravityEffect_.transform.parent = gameObject.transform; // Get a game Controller gameController_ = GameObject.FindGameObjectWithTag("GameController"); if (forceDirection_ < 0.0f) { inGravityEffect_.SendMessage("Play"); outGravityEffect_.SendMessage("Stop"); } else { inGravityEffect_.SendMessage("Stop"); outGravityEffect_.SendMessage("Play"); } inGravityForthEffect_ = Instantiate(Resources.Load("GravityInForthAnimation")) as GameObject; outGravityForthEffect_ = Instantiate(Resources.Load("GravityOutForthAnimation")) as GameObject; inGravityForthEffect_.transform.parent = gravityField_.transform; inGravityForthEffect_.transform.position = gravityField_.transform.position; outGravityForthEffect_.transform.parent = gravityField_.transform; outGravityForthEffect_.transform.position = gravityField_.transform.position; }
// Use this for initialization void Start() { stageManager = GameObject.Find ("StageManager"); stageManager.SendMessage ("EnemySetUp"); stageManager.SendMessage ("StageSetUp"); }
void Fire() { TempBall = Instantiate(Ball, transform.Find("Barrel").transform.position, transform.rotation) as GameObject; TempBall.transform.parent = transform; TempBall.SendMessage("SetLifeSpan", LifeSpan); TempBall.SendMessage("SetBallSpeed", BallSpeed); TempBall.SendMessage("SetLeft", Left); TempBall.SendMessage("SetBounce", BounceHeight); switch (SpeedCase) { case 0: { BroadcastMessage("SetTime", 4); break; } case 1: { BroadcastMessage("SetTime", 1); break; } case 2: { BroadcastMessage("SetTime", 2); break; } case 3: { BroadcastMessage("SetTime", 3); break; } } }
public static void DeliverMessages(GameObject hitObject, ref GameObject [] tgtList, string m, string sp, float fp, string tgFltr, bool msgBmp) { foreach(GameObject o in tgtList) { if(o.tag == tgFltr || tgFltr == "") { Debug.Log (" DELIVERING MESSAGE!!"); if(sp != null) o.SendMessage(m,sp,SendMessageOptions.DontRequireReceiver); if(fp != null) o.SendMessage(m,fp,SendMessageOptions.DontRequireReceiver); } } if(msgBmp) { if(hitObject.tag == tgFltr || tgFltr == "") { Debug.Log (" DELIVERING MESSAGE!!"); if(sp != null) hitObject.SendMessage(m,sp,SendMessageOptions.DontRequireReceiver); if(fp != null) hitObject.SendMessage(m,fp,SendMessageOptions.DontRequireReceiver); } } }
IEnumerator DropItem(GameObject character) { character.SendMessage("Freeze", true); character.SendMessage("Freeze", false); yield return null; }
IEnumerator GrabItem(GameObject character) { character.SendMessage("Freeze", true); transform.parent = character.transform; character.SendMessage("Freeze", false); yield return null; }
void OnMouseDown() { if(GUIUtility.hotControl == 0){ GameObject g = new GameObject(); g.AddComponent<GUI_DetalleStory>(); g.SendMessage("setUserStory", cubous.getUS()); g.SendMessage("Mostrar"); } }
// Use this for initialization void Start () { //Instantiate a self-propelled lazer shot at the turret's position lazerTemp = Instantiate(lazerObject, Vector3.zero, Quaternion.identity) as GameObject; //Set the range the missile can travel before being destroyed lazerTemp.SendMessage("SetRange", range); //Send this gameObject to the missile for sending back successful hits to the player firing the shot lazerTemp.SendMessage("SetPlayer", player); spawnPosition = Vector3.zero; }
void doTaskDetailWindow(int windowID) { GUIComponents.labelDetail(new Rect(20,30,310,20),"Tarea: ",t.getTitulo()); GUI.contentColor = Color.yellow; GUI.Label(new Rect(20,55,310,20),"Descripción:"); int offset = 18*((int)(t.getDescripcion().Length/50)+1); if (offset > 53){ offset = 53; } GUI.contentColor = Color.white; GUI.Label(new Rect(40,75,290,offset),t.getDescripcion()); GUIComponents.labelDetail(new Rect(20,80+offset,310,20),"Responsable: ",t.getResponsable()); GUIComponents.labelDetail(new Rect(20,105+offset,310,20),"Tiempo estimado: ",t.getT_Estimado().ToString()); GUIComponents.labelDetail(new Rect(20,130+offset,310,20),"Tiempo restante: ",(t.getT_Estimado()-t.getT_Total()).ToString()); GUIComponents.labelDetail(new Rect(20,155+offset,310,20),"Tiempo total: ",t.getT_Total().ToString()); GUIComponents.labelDetail(new Rect(20,180+offset,310,20),"Prioridad: ",t.getPrioridad().ToString()); GUIComponents.labelDetail(new Rect(20,205+offset,310,20),"Estado: ",t.getEstado()); if (t.getEstado ().Equals ("ON TEST")) if (GUI.Button (new Rect (maxWidth / 2 - 90, 235 + offset, 185, 20), "Administrar Tests")) { if (Application.isWebPlayer) { GameObject g = new GameObject (); UnityEngineInternal.APIUpdaterRuntimeServices.AddComponent (g, "Assets/Game/Scripts/ScriptsPanelesVS/GUI_DetalleTarea.cs (69,9)", "GUI_Mensaje"); g.SendMessage ("setMensaje", "Esta funcionalidad no esta disponible en la version Web"); g.SendMessage ("setAnterior", this); g.SendMessage ("Mostrar"); openWindow = false; } else { offset += 30; GameObject g = new GameObject (); UnityEngineInternal.APIUpdaterRuntimeServices.AddComponent (g, "Assets/Game/Scripts/ScriptsPanelesVS/GUI_DetalleTarea.cs (77,9)", "GUI_Testing"); g.SendMessage ("setTask", t); g.SendMessage ("setAnterior", this); g.SendMessage ("Mostrar"); openWindow = false; } } puntos=GUIComponents.labelTextField(new Rect(20,maxHeight-60,120,20),puntos,"Story Points: ",30); //GUIComponents.labelTextField(new Rect(20,225+offset,310,20)," ","Cargar Puntos :",4); if (GUI.Button(new Rect (maxWidth / 2 - 130, maxHeight - 30, 100, 20),"Cargar Puntos")){ t.setT_Total(t.getT_Total()+System.Convert.ToInt32(puntos)); MultiPlayer.Instance.cambiarTTotalTask(t); } if (GUI.Button (new Rect (maxWidth/2+20,maxHeight-30,110,20), "Cerrar")) { openWindow = false; try { this.ant.Mostrar (); Destroy (this); } catch { Debug.Log ("No tiene anterior porque viene del taskboard"); } } }
IEnumerator HoldPlayer(GameObject player){ player.SendMessage("Freeze"); player.SendMessage("BubbleCatch"); FindObjectOfType<ScreenShake> ().jiggleCam (0.1f, 2f); FindObjectOfType<LauncherLogic>().PauseLauncher(); FindObjectOfType<BeatMatcher> ().TriggerInXBeats (this, 4); while (true) { yield return new WaitForEndOfFrame(); player.transform.position = transform.position; } }
IEnumerator slowDown(GameObject go) { go.SendMessage ("SlowDown", gameObject); changeColor (new Color(.5f, .5f, 1f), go.transform); while (true) { yield return new WaitForSeconds (1f); go.SendMessage ("UnSlowDown", gameObject); changeColor (Color.white, go.transform); Destroy (gameObject); } }
private void NpcStopped(GameObject npc) { npcIsWaitingForFood = true; firstInLine = npc; npc.GetComponent<SoundCheck>().State = 1; npc.SendMessage("MoveChanged", false, SendMessageOptions.RequireReceiver); npc.SendMessage("ShowSpeechBubble", true, SendMessageOptions.RequireReceiver); soundManager.SendMessage("TriggerGuiSound", GuiSoundMode.SPEEECHBUBBLE, SendMessageOptions.RequireReceiver); npc.SendMessage("TriggerSound",SendMessageOptions.RequireReceiver); StartCoroutine(WaitForChitChat()); }
private void Send(GameObject go, string functionName, object obj = null) { if (go == null) return; if (string.IsNullOrEmpty(functionName)) return; if (obj != null) { go.SendMessage(functionName, obj); } else { go.SendMessage(functionName); } }
void OnInstantiatedSonarPoint(GameObject target) { // すでにソナー内にいるかチェックする Vector3 pos = new Vector3(transform.position.x, 0.0f, transform.position.z); Vector3 target_pos = new Vector3( target.transform.position.x, 0.0f, target.transform.position.z ); float dist = Vector3.Distance(pos, target_pos); Debug.Log("OnInstantiatedSonarPoint[" + target.transform.parent.gameObject.name + "]: dist=" + dist + ", radius=" + radius); if (dist <= radius) { target.SendMessage("OnSonarInside"); } else { target.SendMessage("OnSonarOutside"); } }
private IEnumerator BeginPullingObject(GameObject other) { other.SendMessage("HaltGravity", SendMessageOptions.DontRequireReceiver); while (Vector3.Distance(casterTransform.position, other.transform.position) > 1f) { Vector3 towardsDirection = other.transform.position - casterTransform.position; other.transform.position -= towardsDirection.normalized * grappleSpeed * Time.deltaTime; this.transform.position = other.transform.position + casterVerticalOffset; yield return null; } other.SendMessage("ResumeGravity", SendMessageOptions.DontRequireReceiver); Destroy(this.gameObject); yield break; }
void Update() { RaycastHit hit; Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit)) { if (hit.transform.tag == "Agent" && Input.GetMouseButtonDown(0)) { selectedUnit = hit.transform.gameObject; if (selectedUnits.Contains(selectedUnit)) { selectedUnit.SendMessage("Deselect", 1); selectedUnits.Remove(selectedUnit); } else { selectedUnit.SendMessage("Select", 1); selectedUnits.Add(selectedUnit); } } else if (Input.GetMouseButtonDown(0)) { if (Time.time - lastClickTime < catchTime) { //double click foreach (GameObject g in selectedUnits) { g.SendMessage("DoubleClick", 1); } } lastClickTime = Time.time; foreach (GameObject g in selectedUnits) { g.SendMessage("Destination", hit.point); } } /* if (hit.transform.tag == "Ground" && Input.GetMouseButtonDown(0)) { foreach (GameObject g in selectedUnits) { g.SendMessage("Deselect", 1); } selectedUnits.Clear(); } */ } }
/// <summary> /// Starts the conversation with another game object. /// </summary> /// <param name="obj">Object.</param> public void StartConversation(GameObject obj, string reply = null) { // cannot start another conversation if we have an active one if (activeConversation != null) { return; } ConversationSet conversationSet = obj.GetComponent<ConversationSet>(); if (conversationSet != null) { activeConversation = conversationSet.GetActiveConversation(); if (reply != null && reply != "") { activeConversation.headerText = reply; } // disable rigidbody while in conversation if (_state != null) { _state.state = State.DISABLED; } obj.SendMessage(eventName, SendMessageOptions.DontRequireReceiver); if (uiPrefab != null) { // TODO: finish this _uiShown = Instantiate(uiPrefab) as GameObject; _buttons = _uiShown.GetComponentsInChildren<Button>(); for (int i = 0; i < _buttons.Length; ++i) { // Button.ButtonClickedEvent ev = new Button.ButtonClickedEvent(); // ev.AddListener( // _buttons[i].onClick += OnResponseClick; } Button button; } } }
/// <summary> /// MonoBehaviour method called on GameObject by Unity during initialization phase. /// </summary> public void Start() { CameraWork _cameraWork = gameObject.GetComponent <CameraWork>(); if (_cameraWork != null) { if (photonView.IsMine) { _cameraWork.OnStartFollowing(); } } else { Debug.LogError("<Color=Red><b>Missing</b></Color> CameraWork Component on player Prefab.", this); } // Create the UI if (this.playerUiPrefab != null) { UnityEngine.GameObject _uiGo = Instantiate(this.playerUiPrefab); _uiGo.SendMessage("SetTarget", this, SendMessageOptions.RequireReceiver); } else { Debug.LogWarning("<Color=Red><b>Missing</b></Color> PlayerUiPrefab reference on player Prefab.", this); } #if UNITY_5_4_OR_NEWER // Unity 5.4 has a new scene management. register a method to call CalledOnLevelWasLoaded. UnityEngine.SceneManagement.SceneManager.sceneLoaded += OnSceneLoaded; #endif }
public void AttackUnit(GameObject unit) { gameObject.SendMessage("CheckLegalMove", attackCost); UpdatedTameStatusIfCurrentlySelected(); if (PlayerFunctionalityAndStats.isLegalMove) { UpdateCurrentlySelectedSpecies(); unit.SendMessage("UpdateInteractSpecies"); MinigameMenu.previousInteractUnit = unit; if(!networking || (CharacterManager.aTurn == 1 && Network.isServer) || (CharacterManager.aTurn == 3 && Network.isClient)) GameObject.Find("MiniGameManager").SendMessage("BeginMiniGame", attackPoints); // Play SFX audio.PlayOneShot(soundAttack); //THE SOUND ATTACK WILL COME FROM THE UNIT THAT WE INSTANTIATE IN THIS ROUTINE //Removing Mana if (gameObject.tag == "Player1") { CharacterManager.bird1.SendMessage("RemoveMana", attackCost); } else if (gameObject.tag == "Player2") { CharacterManager.bird2.SendMessage("RemoveMana", attackCost); } } else { if (!PlayerFunctionalityAndStats.isLegalMove) GameObject.Find("GUI Hot Seat").SendMessage("showText", "Insufficient Mana"); else GameObject.Find("GUI Hot Seat").SendMessage("showText", "Can't Attack Again"); } }
//------------------------------------------------- // Attach a GameObject to this GameObject // // objectToAttach - The GameObject to attach // flags - The flags to use for attaching the object // attachmentPoint - Name of the GameObject in the hierarchy of this Hand which should act as the attachment point for this GameObject //------------------------------------------------- public void AttachObject(UnityEngine.GameObject objectToAttach, AttachmentFlags flags = defaultAttachmentFlags, string attachmentPoint = "") { if (flags == 0) { flags = defaultAttachmentFlags; } //Make sure top object on stack is non-null CleanUpAttachedObjectStack(); //Detach the object if it is already attached so that it can get re-attached at the top of the stack DetachObject(objectToAttach); //Detach from the other hand if requested if (((flags & AttachmentFlags.DetachFromOtherHand) == AttachmentFlags.DetachFromOtherHand) && otherHand) { otherHand.DetachObject(objectToAttach); } if ((flags & AttachmentFlags.DetachOthers) == AttachmentFlags.DetachOthers) { //Detach all the objects from the stack while (attachedObjects.Count > 0) { DetachObject(attachedObjects[0].attachedObject); } } if (currentAttachedObject) { currentAttachedObject.SendMessage("OnHandFocusLost", this, SendMessageOptions.DontRequireReceiver); } AttachedObject attachedObject = new AttachedObject(); attachedObject.attachedObject = objectToAttach; attachedObject.originalParent = objectToAttach.transform.parent != null ? objectToAttach.transform.parent.gameObject : null; if ((flags & AttachmentFlags.ParentToHand) == AttachmentFlags.ParentToHand) { //Parent the object to the hand objectToAttach.transform.parent = GetAttachmentTransform(attachmentPoint); attachedObject.isParentedToHand = true; } else { attachedObject.isParentedToHand = false; } attachedObjects.Add(attachedObject); if ((flags & AttachmentFlags.SnapOnAttach) == AttachmentFlags.SnapOnAttach) { objectToAttach.transform.localPosition = Vector3.zero; objectToAttach.transform.localRotation = Quaternion.identity; } HandDebugLog("AttachObject " + objectToAttach); objectToAttach.SendMessage("OnAttachedToHand", this, SendMessageOptions.DontRequireReceiver); UpdateHovering(); }
/// <summary> /// Trigger this event and send the message. /// </summary> /// <param name="actor">the actor to send the message to.</param> public override void Trigger(GameObject actor) { if (actor != null) { actor.SendMessage(MethodName, Parameter, SendMessageOptions); } }
private void AlterHealth(GameObject go) { float multiplier = GetComponent<ParticleSystemMultiplier>().multiplier; short damage = (short)((range * multiplier - Vector3.Distance(transform.position, go.transform.position)) * explosionDamage); damage = (short) -damage; go.SendMessage("CmdAlterHealth", damage, SendMessageOptions.DontRequireReceiver); }
public void doLockdown() { if(triggerLockdown == true) { if (Input.GetMouseButtonDown(0)) { Debug.Log ("Left Clicked LD"); triggerLockdown = false; ray = _camera.ScreenPointToRay(Input.mousePosition); //If we hit... if(Physics.Raycast (ray, out hit, Mathf.Infinity)) { //Tell the system what we clicked something if in debug Collider[] lockdownArray = Physics.OverlapSphere(hit.point, radius, mask); if(lockdownArray.Length > 0) { Debug.Log("lockedown 1"); for(int i = 0; i < lockdownArray.Length; i++) { targetEnemy = lockdownArray[i].gameObject; targetEnemy.SendMessage("setLockdown", true); } } //Run the Clicked() function on the clicked object //hit.transform.gameObject.SendMessage("RightClicked", hit.point, SendMessageOptions.DontRequireReceiver); } } } }
// Update is called once per frame void Update() { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit)) { if (currentHit != hit.transform.gameObject) { if (currentHit != null) { currentHit.SendMessage("UnPointed", SendMessageOptions.DontRequireReceiver); } currentHit = hit.transform.gameObject; currentHit.SendMessage("Pointed", SendMessageOptions.DontRequireReceiver); } Debug.DrawLine(ray.origin, hit.point); } else { if (currentHit != null) { currentHit.SendMessage("UnPointed", SendMessageOptions.DontRequireReceiver); currentHit = null; } } }
// Use this for initialization void Start() { redshirt = GameObject.Find ("R-SHIRT"); blueshirt = GameObject.Find ("B-SHIRT"); Collider[] thingsHit = Physics.OverlapSphere (transform.position, radius); foreach (Collider other in thingsHit) { if (other.CompareTag ("Player") || other.CompareTag ("Player 2")) { float dist = Vector3.Distance (transform.position, other.transform.position); float percent = radius / dist; waterScore = percent * waterAmount; //print(waterScore); other.gameObject.SendMessage("getWet", waterScore); other.gameObject.SendMessage("GotHit"); if (other.CompareTag ("Player 2") && other.GetComponent<BP1Mov>().bubbleshield == false){ redshirt.SendMessage("Hit", waterScore); } if (other.CompareTag ("Player") && other.GetComponent<BP1Mov>().bubbleshield == false){ blueshirt.SendMessage("Hit", waterScore); } } } }
/** * This method receives a gameObject and checks for collision. * It checks to see if the lesion gameObjects are water disolvable, increments the collected lesion's count on HUD and destroys the objects disolved. * \param other is the currently colliding gameObject. */ void OnParticleCollision(GameObject other) { Rigidbody body = other.rigidbody; if (body) { if (body.name == "ObstacleSphere2") { Destroy(GameObject.Find("ObstacleSphere2")); TrainingController.sessionLesions = TrainingController.sessionLesions + 1; ObstaclesSet.SendMessage("TurnOnLesions", 2); lesionTag = GameObject.Find("LesionTag2"); lesionTag.SendMessage("DestroyTag", true); } else if (body.name == "ObstacleSphere4") { TrainingController.sessionLesions = TrainingController.sessionLesions + 1; Destroy(GameObject.Find("ObstacleSphere4")); } ======= void OnParticleCollision(GameObject other) { Rigidbody body = other.rigidbody; if (body) { Destroy(GameObject.Find("ObstacleSphere2")); TrainingController.sessionLesions = TrainingController.sessionLesions + 1; ObstaclesSet.SendMessage("TurnOnLesions", 2); lesionTag = GameObject.Find("LesionTag2"); lesionTag.SendMessage("DestroyTag", true); >>>>>>> 9f1edfb2b5abdad31c478054209af1964fca0dc9 } } }
// Old PlayerCollisions Code prior to Raycast Change // // Boolean to determine if door is open. On start, the door should be closed hence the 'false' initialization // bool doorIsOpen = false; // // // Counter/Timer to determine how long door remains open upon trigger // float doorTimer = 0.0f; // // // public float allowing me to adjust how long door must be open in the Inspector // public float doorOpenTime = 3.0f; // // //Audio // public AudioClip doorOpenSound; // public AudioClip doorShutSound; // // // Use this for initialization // void Start () { // // } void Update() { RaycastHit hit; if (Physics.Raycast (transform.position, transform.forward, out hit, 3)) { if (hit.collider.gameObject.tag=="playerDoor") { currentDoor = hit.collider.gameObject; currentDoor.SendMessage("DoorCheck"); } } // Old PlayerCollisions Code prior to Raycast Change // if(doorIsOpen) // { // doorTimer+= Time.deltaTime; // // if (doorTimer > doorOpenTime) // { // //ShutDoor(currentDoor); // Door(doorShutSound, false,"doorshut", currentDoor); // doorTimer = 0.0f; // } // } }
/// <summary> /// This method decides if the state should transition to another on its list /// NPC is a reference to the object that is controlled by this class /// </summary> public override void Reason(GameObject player, GameObject npc) { if(Vector3.Distance(player.transform.position, npc.transform.position) > 30){ npc.SendMessage("OnHandlePerformTransition", Transition.LostPlayer, SendMessageOptions.RequireReceiver); } }
public void take() { myAppleTree.SendMessage("eatApple"); player = GameObject.FindGameObjectWithTag("Player"); player.SendMessage("take"); Destroy(this.gameObject); }
public void SetScriptCommand(GameObject doingObject, string scriptCommand, string[] arrayOfParameter) { ScriptParameter scriptParameter; scriptParameter.ScriptCommand = scriptCommand; scriptParameter.ArrayOfParameter = arrayOfParameter; doingObject.SendMessage("ReceiveScriptFlag", scriptParameter); }
static public int SendMessage(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.SendMessage(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.SendMessage(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.SendMessage(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.SendMessage(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)); } }
/// <summary> /// MonoBehaviour method called after a new level of index 'level' was loaded. /// We recreate the Player UI because it was destroy when we switched level. /// Also reposition the player if outside the current arena. /// </summary> /// <param name="level">Level index loaded</param> void CalledOnLevelWasLoaded(int level) { // check if we are outside the Arena and if it's the case, spawn around the center of the arena in a safe zone if (!Physics.Raycast(transform.position, -Vector3.up, 5f)) { transform.position = new Vector3(0f, 5f, 0f); } UnityEngine.GameObject _uiGo = Instantiate(this.playerUiPrefab); _uiGo.SendMessage("SetTarget", this, SendMessageOptions.RequireReceiver); }
static public int SendMessage(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.SendMessage(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.SendMessage(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.SendMessage(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.SendMessage(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 SendMessage__String(IntPtr l) { try { UnityEngine.GameObject self = (UnityEngine.GameObject)checkSelf(l); System.String a1; checkType(l, 2, out a1); self.SendMessage(a1); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
//------------------------------------------------- void Update() { UpdateNoSteamVRFallback(); UnityEngine.GameObject attached = currentAttachedObject; if (attached) { attached.SendMessage("HandAttachedUpdate", this, SendMessageOptions.DontRequireReceiver); } if (hoveringInteractable) { hoveringInteractable.SendMessage("HandHoverUpdate", this, SendMessageOptions.DontRequireReceiver); } }
public static int SendMessage2_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.SendMessage(arg0); } catch (Exception e) { Debug.LogException(e); } return(0); }
static int SendMessage(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.SendMessage(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.SendMessage(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.SendMessage(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.SendMessage(arg0, arg1, arg2); return(0); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.GameObject.SendMessage")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
public static int SendMessage1_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.SendMessage(arg0, arg1); } catch (Exception e) { Debug.LogException(e); } return(0); }
static public int SendMessage__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.SendMessage(a1, a2, a3); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
// Update is called once per frame private void Update() { if (!Input.GetMouseButtonDown(0)) { return; } Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (!Physics.Raycast(ray, out hit)) { return; } transform.position = hit.point + hit.normal * surfaceOffset; if (setTargetOn != null) { setTargetOn.SendMessage("SetTarget", transform); } }
//Unity GUI function for Property Drawer public override void OnGUI(Rect _Position) { // First get the attribute SimpleButtonNewAttribute tAttribute = attribute as SimpleButtonNewAttribute; UnityEngine.GameObject theObject = Selection.activeGameObject; //.GetComponent(tAttribute.ClassType) as UnityEngine.Object; if (GUI.Button(_Position, tAttribute.ButtonName)) { //Match found get the function in MethodInfo for Invoke //Debug.Log("Found match: " + TargetObjects[i].GetType() + " " + tFunction.ClassType); if (theObject != null) { //Invoke the method if != null Note: It works only of you dont need special parameters! (null) theObject.SendMessage(tAttribute.FunctionName, null); } } }
//------------------------------------------------- // Detach this GameObject from the attached object stack of this Hand // // objectToDetach - The GameObject to detach from this Hand //------------------------------------------------- public void DetachObject(UnityEngine.GameObject objectToDetach, bool restoreOriginalParent = true) { int index = attachedObjects.FindIndex(l => l.attachedObject == objectToDetach); if (index != -1) { HandDebugLog("DetachObject " + objectToDetach); UnityEngine.GameObject prevTopObject = currentAttachedObject; Transform parentTransform = null; if (attachedObjects[index].isParentedToHand) { if (restoreOriginalParent && (attachedObjects[index].originalParent != null)) { parentTransform = attachedObjects[index].originalParent.transform; } attachedObjects[index].attachedObject.transform.parent = parentTransform; } attachedObjects[index].attachedObject.SetActive(true); attachedObjects[index].attachedObject.SendMessage("OnDetachedFromHand", this, SendMessageOptions.DontRequireReceiver); attachedObjects.RemoveAt(index); UnityEngine.GameObject newTopObject = currentAttachedObject; //Give focus to the top most object on the stack if it changed if (newTopObject != null && newTopObject != prevTopObject) { newTopObject.SetActive(true); newTopObject.SendMessage("OnHandFocusAcquired", this, SendMessageOptions.DontRequireReceiver); } } CleanUpAttachedObjectStack(); }
static int SendMessage(IntPtr L) { try { ++LuaException.SendMsgCount; 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.SendMessage(arg0); --LuaException.SendMsgCount; 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()); } 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.SendMessage(arg0, arg1); --LuaException.SendMsgCount; 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()); } 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.SendMessage(arg0, arg1); --LuaException.SendMsgCount; 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()); } 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.SendMessage(arg0, arg1, arg2); --LuaException.SendMsgCount; 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()); } return(0); } else { --LuaException.SendMsgCount; return(LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.GameObject.SendMessage")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
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"); } } } }
static int QPYX_SendMessage_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.SendMessage(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.SendMessage(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.SendMessage(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.SendMessage(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.SendMessage")); } } catch (Exception e) { --LuaException.SendMsgCount; LuaException.L = L0_YXQP; return(LuaDLL.toluaL_exception(L_YXQP, e)); } }
static public int SendMessage(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.SendMessage(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.SendMessage(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.SendMessage(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.SendMessage(a1, a2, a3); pushValue(l, true); return(1); } pushValue(l, false); LuaDLL.lua_pushstring(l, "No matched override function SendMessage 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 }
static int SendMessage(IntPtr L) { #if UNITY_EDITOR ToluaProfiler.AddCallRecord("UnityEngine.GameObject.SendMessage"); #endif 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.SendMessage(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.SendMessage(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.SendMessage(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.SendMessage(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.SendMessage")); } } catch (Exception e) { --LuaException.SendMsgCount; LuaException.L = L0; return(LuaDLL.toluaL_exception(L, e)); } }