找回密碼
 注冊帳號

掃一掃,訪問微社區

component.comparetag 比較標簽

2015-1-5 03:47| 發布者: 楊炎| 查看: 3062| 評論: 0|原作者: 蠻牛|來自: unity3d腳本manual

摘要: component.comparetag 比較標簽functioncomparetag(tag: string) : booldescription描述is this game object tagged tag?游戲物體有被標記標簽么?c#javascriptusing unityengine;using system.collections;public c ...

component.comparetag 比較標簽

functioncomparetag(tag: string) : bool

description描述

is this game object tagged tag?

游戲物體有被標記標簽么?

c#

javascript

using unityengine;

using system.collections;

public class example :monobehaviour{

void ontriggerenter(collider other) {

if (other.comparetag("player"))

destroy(other.gameobject);

}

}

// immediate death trigger.

//立即死亡觸發

// destroys any colliders that enter the trigger, if they are tagged player.

//如果它們標簽是player,進入這個觸發器將銷毀任何碰撞

function ontriggerenter (other : collider) {

if (other.comparetag ("player")) {

destroy (other.gameobject);

}

}

相關閱讀

文章點評
相關文章
女校游泳队彩金