방명록
- 유니티 게임개발 - 게임 개발 심화 팀 과제 #12023년 10월 13일 21시 21분 40초에 업로드 된 글입니다.작성자: noun06
우리 팀은 여러가지 미니 게임들을 합친 프로젝트를 기획하였고 나는 그 중 마리오 파티의 빙빙시계를 모티브로 간단한 생존 게임을 제작하였다. 상단 회전 장애물은 일정한 시간마다 회전 속도를 계속 증가시키고 회전 방향을 바꾼다. 플레이어와 충돌 시 게임이 종료된다. 플레이어 세부적인 애니메이션은 공통 기능으로 추후에 추가할 예정이다.
public class RotateObjectT : MonoBehaviour { [SerializeField] private float initialRotationSpeed; [SerializeField] private float accelerationRate; [SerializeField] private float phaseDuration; private float timeInCurrentPhase = 0.0f; private float rotationSpeed = 0.0f; private int rotateDirection = -1; private void Start() { rotationSpeed = initialRotationSpeed; } private void Update() { timeInCurrentPhase += Time.deltaTime; if (timeInCurrentPhase >= phaseDuration) { timeInCurrentPhase = 0.0f; rotationSpeed += accelerationRate; rotateDirection = -rotateDirection; } Vector3 rotation = Vector3.zero; rotation[1] = rotationSpeed * rotateDirection * Time.deltaTime; transform.Rotate(rotation); } private void OnCollisionEnter(Collision collision) { if (collision.gameObject.CompareTag("Player")) { Debug.Log("Hit"); } } }
다음글이 없습니다.이전글이 없습니다.댓글