[Update] 게임형식 및 오류수정

1. 게임형태 변경
  - Game스텝에서 기존 1단계, 2단계 수정(회전만 가능하게).
  - ShootButton을 만들어 플레이어도 총알을 쏠수 있도록 수정.
  - Bullet, BulletSpawner, PlayerController를 수정
  - SpawnZone을 생성하여 기존 고정이던 스포너를 랜덤으로 생성.

2. 오류 수정
 - 모바일 버전 시 플레이어가 한방향만 보던 형상 수정.
 - 펜스에서 플레이어 캐릭터가 닿으면 회전하던 형상 수정.
This commit is contained in:
jongjae0305
2026-04-29 09:22:08 +09:00
parent ed1e24be1d
commit 8298b2559c
34 changed files with 3558 additions and 2408 deletions
+47
View File
@@ -0,0 +1,47 @@
using UnityEngine;
using UnityEngine.EventSystems;
public class ShootButton : MonoBehaviour, IPointerDownHandler, IPointerUpHandler
{
[SerializeField] private float rotationLimit = 40;
[SerializeField] private float rotationSpeed = 15;
private bool rotate = false;
private bool isDisabled = false;
public PlayerController playerController;
void FixedUpdate()
{
float targetRotate = rotate ? rotationLimit : 0f;
Quaternion target = Quaternion.Euler(targetRotate, 0, 0);
transform.rotation = Quaternion.Slerp(transform.rotation, target, Time.deltaTime * rotationSpeed);
}
public void OnPointerDown(PointerEventData pointerEventData)
{
if (isDisabled) return;
rotate = true;
if (playerController != null)
{
Vector2? input = (GameSettings.IsMobile && playerController.joystick != null)
? playerController.joystick.GetInput()
: null;
playerController.Shoot(input);
}
}
public void OnPointerUp(PointerEventData pointerEventData)
{
rotate = false;
}
// 외부에서 호출
public void SetDisabled(bool disabled)
{
isDisabled = disabled;
if (disabled) rotate = false;
}
}