using System.Collections; using System.Collections.Generic; using UnityEngine; // ÆÄÀÏ À̸§ÀÌ 'PlayerCtrller'¿©¾ß ÇÕ´Ï´Ù (¶ç¾î¾²±â Àý´ë ±ÝÁö!) public class PlayerCtrller : MonoBehaviour { public Rigidbody playerRigidbody; public float speed = 8f; void Start() { } void Update() { if (Input.GetKey(KeyCode.UpArrow)) { playerRigidbody.AddForce(0f, 0f, speed); } if (Input.GetKey(KeyCode.DownArrow)) { playerRigidbody.AddForce(0f, 0f, -speed); } if (Input.GetKey(KeyCode.RightArrow)) { playerRigidbody.AddForce(speed, 0f, 0f); } if (Input.GetKey(KeyCode.LeftArrow)) { playerRigidbody.AddForce(-speed, 0f, 0f); } } // <--- Update ÇÔ¼ö°¡ ¿©±â¼­ µü ³¡³ª¾ß ÇÕ´Ï´Ù! // Die ÇÔ¼ö´Â Update ¹Û(¾Æ·¡)¿¡ ÀÖ¾î¾ß ÇÕ´Ï´Ù. public void Die() { gameObject.SetActive(false); } }