
카메라 따라가기 기능
public class CameraFollow : MonoBehaviour
{
public Transform player; // 플레이어의 Transform 컴포넌트를 연결할 변수
public Vector3 offset = new Vector3(0f, 0f, -5f);
void Update()
{
if (player != null)
{
// 플레이어의 현재 위치에 오프셋 값을 더하여 카메라 위치를 설정
transform.position = player.position + offset;
}
}
}
현재 시간표시 기능
public class CurrentTime : MonoBehaviour
{
public Text timeText;
void Update()
{
// 현재 시간을 얻어옴
DateTime currentTime = DateTime.Now;
// 시, 분, 초 정수형으로 가져오기
int hours = currentTime.Hour;
int minutes = currentTime.Minute;
int seconds = currentTime.Second;
// 텍스트 문자열로 표시
timeText.text = string.Format("{0:D2}:{1:D2}:{2:D2}", hours, minutes, seconds);
}
}
추가 구현해야할 내용
1. 플레이어 이름, 캐릭터 선택하기
2. 인게임에서 플레이어 이름, 캐릭터 변경하기
3. 플레이 중인 캐릭터 이름 표시하기