using System.Collections; using System.Collections.Generic; using UnityEngine; // ÆÄÀÏ À̸§ÀÌ 'PlayerCtrller'¿Í Á¤È®È÷ ÀÏÄ¡ÇØ¾ß ÇÕ´Ï´Ù. public class PlayerController : MonoBehaviour { private Rigidbody playerRigidbody; public float speed = 8f; void Start() { playerRigidbody = GetComponent(); } void Update() { float xInput = Input.GetAxis("Horizontal"); float zInput = Input.GetAxis("Vertical"); float xSpeed = xInput * speed; float zSpeed = zInput * speed; Vector3 newVelocity = new Vector3(xSpeed, 0f, zSpeed); playerRigidbody.linearVelocity = newVelocity; } public void Die() { FindObjectOfType().EndGame(); gameObject.SetActive(false); } }