本文整理汇总了C#中UnityEngine.Collider2D.SendMessage方法的典型用法代码示例。如果您正苦于以下问题:C# Collider2D.SendMessage方法的具体用法?C# Collider2D.SendMessage怎么用?C# Collider2D.SendMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEngine.Collider2D
的用法示例。
在下文中一共展示了Collider2D.SendMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnTriggerStay2D
void OnTriggerStay2D(Collider2D col)
{
if (col.GetComponent<InteractController>() != null && col.GetComponent<InteractController>().message == "") {
col.SendMessage("GetMessage", this.usestring1 + "\n" + this.usestring2 + "\n" + this.usestring3 + "\n" + this.usestring4);
col.SendMessage("GetGO", this.gameObject);
}
}
示例2: OnTriggerEnter2D
void OnTriggerEnter2D(Collider2D col)
{
if (col.GetComponent<InteractController>() != null) {
col.SendMessage("GetMessage", this.usestring);
col.SendMessage("GetGO", this.gameObject);
}
}
示例3: OnTriggerExit2D
void OnTriggerExit2D(Collider2D col)
{
if (col.GetComponent<InteractController>() != null) {
col.SendMessage("GetMessage", "");
col.SendMessage("LoseGO");
}
}
示例4: OnTriggerEnter2D
void OnTriggerEnter2D(Collider2D col)
{
if (col.GetComponent<InteractController>() != null) {
col.SendMessage("GetMessage", "Press " + this.usekey.ToString () + " to exit map!");
col.SendMessage("GetGO", this.gameObject);
}
}
示例5: OnTriggerEnter2D
void OnTriggerEnter2D(Collider2D other)
{
if (_velocity.magnitude > minimumVelocity)
{
other.SendMessage ("Hit", SendMessageOptions.DontRequireReceiver);
other.SendMessage ("KnockBack", new KnockBackArgs(transform.position,knockBackAmount), SendMessageOptions.DontRequireReceiver);
}
}
示例6: OnTriggerStay2D
void OnTriggerStay2D(Collider2D col)
{
if (col.gameObject.Equals(Player)){
if(Player.GetComponent<HealthController>().acceptingOxy && oxygenAmt > 0) {
oxygenAmt -= 3 * Time.deltaTime;
col.SendMessage("changeOxy", 10 * Time.deltaTime);
col.SendMessage("GettingOxy", true);
}
}
}
示例7: OnTriggerEnter2D
void OnTriggerEnter2D(Collider2D other) {
// What direction are we going around the lap?
var trackDirection = Vector3.Dot(Vector3.Cross(other.transform.position, other.GetComponent<Rigidbody2D>().velocity), new Vector3(0, 0, 1));
// Only lap if going in the right direction.
if (trackDirection > 0) {
other.SendMessage ("AddLap");
} else {
other.SendMessage ("RemoveLap");
}
}
示例8: OnTriggerEnter2D
void OnTriggerEnter2D(Collider2D other){
if (other.gameObject.tag == "Finish")
Destroy (gameObject);
if (other.tag == "Enemy") {
other.SendMessage ("ApplyDamage", 1);
Destroy (gameObject);
}
if (other.tag == "Player")
{
other.SendMessage("Die", 1);
Destroy(gameObject);
}
}
示例9: OnTriggerEnter2D
void OnTriggerEnter2D(Collider2D other)
{
if (other.tag == "Enemy") {
other.SendMessage ("Damage", damage);
other.GetComponent<Rigidbody2D> ().AddForce (new Vector2 (transform.up.x, transform.up.y) * speed, ForceMode2D.Impulse);
}
}
示例10: OnTriggerEnter2D
void OnTriggerEnter2D(Collider2D other)
{
if (other.tag == "Enemy") {
other.SendMessage ("Damage", damage * multiplier);
Destroy (gameObject);
}
}
示例11: OnTriggerEnter2D
void OnTriggerEnter2D(Collider2D other)
{
if (other.CompareTag("Player"))
{
other.SendMessage("ApplyGrannyDamage", SendMessageOptions.DontRequireReceiver);
}
}
示例12: OnTriggerEnter2D
void OnTriggerEnter2D(Collider2D other)
{
switch(other.gameObject.tag)
{
default:
break;
case "BulletQ":
Destroy (other.gameObject);
gameObject.SendMessage("ApplyDamage",1);
break;
case "BulletW":
Destroy(other.gameObject);
Slow ();
break;
case "BulletE":
Destroy (other.gameObject);
gameObject.SendMessage("ApplyDamage",2);
break;
case "Player":
other.SendMessage("ApplyDamage");
Destroy(gameObject);
break;
}
}
示例13: OnTriggerEnter2D
void OnTriggerEnter2D(Collider2D collideObject)
{
if (collideObject.gameObject.layer == _playerLayer)
{
collideObject.SendMessage("DeathTriggerHit", SendMessageOptions.DontRequireReceiver);
}
}
示例14: OnTriggerEnter2D
void OnTriggerEnter2D(Collider2D col) {
if (col.tag == "Player") return;
//if (col.tag == "Enemy") Destroy(col.gameObject);
Destroy (this.gameObject); //col.transform.GetComponent<EnemyScript>().
if (col.tag == "Enemy") col.transform.GetComponent<EnemyScript>().Death();
if (col.tag == "Crate") col.SendMessage("DropItem");
}
示例15: OnTriggerEnter2D
/**
*
*/
public void OnTriggerEnter2D(Collider2D other)
{
if (this.IsLit())
{
other.SendMessage("OnFlameEnter", this, SendMessageOptions.DontRequireReceiver);
}
}