当前位置: 首页>>代码示例>>C#>>正文


C# GameObject.SendMessage方法代码示例

本文整理汇总了C#中UnityEngine.GameObject.SendMessage方法的典型用法代码示例。如果您正苦于以下问题:C# GameObject.SendMessage方法的具体用法?C# GameObject.SendMessage怎么用?C# GameObject.SendMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UnityEngine.GameObject的用法示例。


在下文中一共展示了GameObject.SendMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Update

    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);
            }
        }
    }
开发者ID:johntyu,项目名称:Game_49,代码行数:30,代码来源:ExplodeEnemyOnCollision.cs

示例2: DeliverMessages

	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);
			}
		}
	}
开发者ID:AVataRR626,项目名称:https---github.com-AVataRR626-Goat_Mage,代码行数:30,代码来源:BumpMessage.cs

示例3: Update

    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);
                }

        }
    }
开发者ID:andyminnella,项目名称:MIS,代码行数:28,代码来源:TouchController.cs

示例4: Fire

 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;
             }
     }
 }
开发者ID:ErrorMacro13,项目名称:SGP7thTentacleProject,代码行数:32,代码来源:FireBallCannonScript.cs

示例5: DropItem

    IEnumerator DropItem(GameObject character)
    {
        character.SendMessage("Freeze", true);

        character.SendMessage("Freeze", false);
        yield return null;
    }
开发者ID:Booljayj,项目名称:BREACH,代码行数:7,代码来源:ItemActivator.cs

示例6: Start

	// 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;
    }
开发者ID:CaramelTeam,项目名称:TridentGamejam2014,代码行数:35,代码来源:Player.cs

示例7: Start

    // Use this for initialization
    void Start()
    {
        stageManager = GameObject.Find ("StageManager");

        stageManager.SendMessage ("EnemySetUp");
        stageManager.SendMessage ("StageSetUp");
    }
开发者ID:choirdesign,项目名称:hack-slash,代码行数:8,代码来源:StageManagerColl.cs

示例8: GrabItem

    IEnumerator GrabItem(GameObject character)
    {
        character.SendMessage("Freeze", true);
        transform.parent = character.transform;

        character.SendMessage("Freeze", false);
        yield return null;
    }
开发者ID:Booljayj,项目名称:BREACH,代码行数:8,代码来源:ItemActivator.cs

示例9: Start

	// 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;
	}
开发者ID:kalby,项目名称:SpaceCOG-Prototype,代码行数:10,代码来源:LazerRangeTest.cs

示例10: OnMouseDown

 void OnMouseDown()
 {
     if(GUIUtility.hotControl == 0){
             GameObject g = new GameObject();
             g.AddComponent<GUI_DetalleStory>();
             g.SendMessage("setUserStory", cubous.getUS());
             g.SendMessage("Mostrar");
         }
 }
开发者ID:CristianCosta,项目名称:Kinect,代码行数:9,代码来源:usPlaneBehavior.cs

示例11: doTaskDetailWindow

    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");
            }
        }
    }
开发者ID:CristianCosta,项目名称:Kinect,代码行数:56,代码来源:GUI_DetalleTarea.cs

示例12: slowDown

	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);
		}
	}
开发者ID:tchrisbaker,项目名称:Unity3DRPG,代码行数:11,代码来源:IceProjectilie.cs

示例13: HoldPlayer

	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;
		}
	}
开发者ID:5thFloorGames,项目名称:TheMusicGame,代码行数:11,代码来源:ProjectileMovement.cs

示例14: NpcStopped

    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());
    }
开发者ID:johannes-qvarford,项目名称:LunchLadySimulator,代码行数:12,代码来源:QueueControl.cs

示例15: Send

    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);
        }
    }
开发者ID:imlovee,项目名称:WatchRemember_Final,代码行数:14,代码来源:ZinBehaviours.cs


注:本文中的UnityEngine.GameObject.SendMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。