public GameObject RockIcon;
void Start() {
Instantiate(RockIcon,new Vector3(this.gameObject.transform.position.x,this.gameObject.transform.position.y + 1,this.gameObject.transform.position.z),Quaternion.identity);
}
// Update is called once per frame
void Update()
{
if(!isCrash){
transform.position += (Vector3.left * 3) * Time.deltaTime;
RockIcon.transform.position = (new Vector3(this.gameObject.transform.position.x,this.gameObject.transform.position.y + 1,this.gameObject.transform.position.z) * 3) * Time.deltaTime;
}
else{
transform.Rotate(Vector3.forward, 1500 * Time.deltaTime);
transform.position += (Vector3.right * 9) * Time.deltaTime;
transform.position += (new Vector3(0,up,0) * 9) * Time.deltaTime;
}
์์๋ ์๋๋ฏธ ์ค๋ธ์ ํธ์ ์ฌ์ฉํ๋ ์คํฌ๋ฆฝํธ์ค ์ผ๋ถ์ธ๋ฐ์
Start()์์ ์๋๋ฏธ๊ฐ ์ค๋ธ์ ํธ ํ๋๋ฅผ ์ํํ๊ณ
update()์์ ์ด ์ค๋ธ์ ํธ๊ฐ ์๋๋ฏธ๋ฅผ ๋ฐ๋ผ๋ค๋๊ฒ ํ๋ ค๊ณ ํ๋๋ฐ ์์์ฒ๋ผ ํ๋๊น ์ค๋ธ์ ํธ๊ฐ ์ํ์ ๋๋๋ฐ ๋ฐ๋ผ์ค์ง๋ฅผ ์๋ค์ ๋ญ๊ฐ ๋ฌธ์ ์ธ๊ฐ์
Start์์ Instantiateํ ๊ฐ์ฒด๊ฐ ์๋๋ผ RockIcon์๋ณธ ๊ฐ์ฒด๋ฅผ ์์ง์ด๊น ์๋ฐ๋ผ์ค์ง
๊ฐ์ฌํฉ๋๋ค