40 lines
961 B
C#
40 lines
961 B
C#
|
|
using System.Collections;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using UnityEngine;
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD> <20≯<EFBFBD><CCB8><EFBFBD> 'PlayerCtrller'<27><><EFBFBD><EFBFBD> <20>մϴ<D5B4> (<28><><EFBFBD><EFBFBD><EEBEB2> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>!)
|
|||
|
|
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 <20>Լ<EFBFBD><D4BC><EFBFBD> <20><><EFBFBD>⼭ <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>մϴ<D5B4>!
|
|||
|
|
|
|||
|
|
// Die <20>Լ<EFBFBD><D4BC><EFBFBD> Update <20><>(<28>Ʒ<EFBFBD>)<29><> <20>־<EFBFBD><D6BE><EFBFBD> <20>մϴ<D5B4>.
|
|||
|
|
public void Die()
|
|||
|
|
{
|
|||
|
|
gameObject.SetActive(false);
|
|||
|
|
}
|
|||
|
|
}
|