[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
+24 -43
View File
@@ -2,17 +2,21 @@ using UnityEngine;
public class NewMonoBehaviourScript : MonoBehaviour
{
public GameObject[] spawners;
public Rotator rotator;
private GameManager gameManager;
private int currentStep = 0;
private int lastMaxCount = 2;
private int lastStep = -1;
void Start()
{
gameManager = FindFirstObjectByType<GameManager>();
InitializeDifficulty();
gameManager.UpdateMaxSpawnerCount(2);
UpdateStep(0);
}
void Update()
@@ -20,71 +24,48 @@ public class NewMonoBehaviourScript : MonoBehaviour
if (gameManager == null) return;
float currentTime = gameManager.GetSurviveTime();
int targetStep = 1;
if (currentTime > 30f) targetStep = 4;
else if (currentTime > 20f) targetStep = 3;
else if (currentTime > 10f) targetStep = 2;
else targetStep = 1;
int targetMax = 2;
if (currentStep != targetStep)
if (currentTime > 10f)
{
UpdateStep(targetStep);
targetMax = 2 + Mathf.FloorToInt((currentTime - 10f) / 4f);
}
}
if(targetMax != lastMaxCount)
{
lastMaxCount = targetMax;
gameManager.UpdateMaxSpawnerCount(targetMax);
}
void InitializeDifficulty()
{
foreach (var s in spawners) s.SetActive(false);
if (rotator != null) rotator.enabled = false;
UpdateStep(1);
int currentStep = (int)currentTime / 10;
if (currentStep != lastStep)
{
lastStep = currentStep;
UpdateStep(currentStep);
}
}
void UpdateStep(int step)
{
currentStep = step;
switch (step)
{
case 0:
case 1:
SetSpawnersActive(2);
if (rotator != null) rotator.enabled = false;
break;
case 2:
SetSpawnersActive(4);
if (rotator != null) rotator.enabled = false;
break;
case 3:
SetSpawnersActive(4);
if (rotator != null) rotator.enabled = true;
break;
case 4:
SetSpawnersActive(4);
if (rotator != null) rotator.enabled = true;
UpgradeBullSpeed(12f);
break;
}
}
void SetSpawnersActive(int count)
{
for(int i = 0; i < spawners.Length; i++)
{
spawners[i].SetActive(i < count);
}
}
void UpgradeBullSpeed(float newSpeed)
{
foreach (var obj in spawners)
{
if (obj == null) continue;
BulletSpawner spawner = obj.GetComponent<BulletSpawner>();
if (spawner != null) spawner.bulletSpeed = newSpeed;
default:
if (rotator != null) rotator.enabled = true;
break;
}
}
}