-2

有人能告诉我这个脚本有什么问题吗?

#pragma strict

private var dead = false;

function OnControllerColliderHit(hit : ControllerColliderHit) 
{
    if(hit.gameObject.tag == "Respawn")
    {
        dead = true;
    }   
} 

function Update ()
{
    if(dead)
    {
        transform.position = Vector3(0,0,0);
        dead = false;
    } 
}
}
4

1 回答 1

0

从最后一行中删除}最后一行,或者复制并粘贴这一行:

#pragma strict

private var dead = false;

function OnControllerColliderHit(hit : ControllerColliderHit) 
{
    if(hit.gameObject.tag == "Respawn")
    {
        dead = true;
    }   

} 

function Update ()
{
    if(dead)
    {
        transform.position = Vector3(0,0,0);
        dead = false;
    } 
}
于 2013-04-29T02:18:06.370 回答