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


C# GameObject.SendMessageUpwards方法代码示例

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


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

示例1: Press

 private void Press(Vector2 screenPos)
 {
     lastGo = RaycastObject(screenPos);
     if (lastGo != null)
     {
         lastGo.SendMessageUpwards("OnPress", SendMessageOptions.DontRequireReceiver);
     }
 }
开发者ID:jdohgamer,项目名称:SSC,代码行数:8,代码来源:InputToEvent.cs

示例2: Attack

 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);
     }
 }
开发者ID:piotrdubiel,项目名称:polyjam,代码行数:9,代码来源:FoodBehaviour.cs

示例3: attackObject

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

示例4: Update

 // 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();
             }
         }
     }
 }
开发者ID:PaulMilla,项目名称:2Dcapstone,代码行数:20,代码来源:Laser.cs

示例5: DoSendMessage

		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;
			}
		}
开发者ID:AlexanderUrbano,项目名称:shapewars,代码行数:95,代码来源:SendMessage.cs

示例6: Update

    // 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);
    }
开发者ID:ralphlizard,项目名称:HotPatata,代码行数:23,代码来源:GazeController.cs

示例7: sendAction

 void sendAction(GameObject target)
 {
     Debug.Log (target.name);
     target.SendMessageUpwards ("Interaction");
 }
开发者ID:angrykoala,项目名称:3d-babel,代码行数:5,代码来源:User.cs

示例8: BroadcastUpwards

 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);
 }
开发者ID:scadieux,项目名称:Generations,代码行数:6,代码来源:Message.cs


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