void Start() { if (transform.childCount > 0) { door = transform.GetChild(0); } player = GameObject.FindGameObjectWithTag(Tags.player); playerInventory = player.GetComponent <fps_PlayerInventory>(); audioSources = this.GetComponent <AudioSource>(); door.localPosition = from; }
void Start() //初始化 { if (transform.childCount > 0) //transform.childCount:获取子物体数量 { door = transform.GetChild(0); //获取子物体 } player = GameObject.FindGameObjectWithTag(Tags.player); playerInventory = player.GetComponent <fps_PlayerInventory>(); audioSources = this.GetComponent <AudioSource>(); door.localPosition = from;//设置门的初始位置 }
void Start() { player = GameObject.FindGameObjectWithTag(Tags.player); playerInventory = player.GetComponent <fps_PlayerInventory>(); }