2026-04-14 17:06:58 +09:00
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
public class NewMonoBehaviourScript : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
public GameObject[] spawners;
|
|
|
|
|
public Rotator rotator;
|
|
|
|
|
|
|
|
|
|
private GameManager gameManager;
|
|
|
|
|
private int currentStep = 0;
|
|
|
|
|
|
|
|
|
|
void Start()
|
|
|
|
|
{
|
|
|
|
|
gameManager = FindFirstObjectByType<GameManager>();
|
|
|
|
|
|
|
|
|
|
InitializeDifficulty();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Update()
|
|
|
|
|
{
|
|
|
|
|
if (gameManager == null) return;
|
|
|
|
|
|
|
|
|
|
float currentTime = gameManager.GetSurviveTime();
|
|
|
|
|
int targetStep = 1;
|
|
|
|
|
|
2026-04-16 15:04:32 +09:00
|
|
|
if (currentTime > 10f) targetStep = 4;
|
2026-04-14 17:06:58 +09:00
|
|
|
else if (currentTime > 20f) targetStep = 3;
|
|
|
|
|
else if (currentTime > 10f) targetStep = 2;
|
|
|
|
|
else targetStep = 1;
|
|
|
|
|
|
|
|
|
|
if (currentStep != targetStep)
|
|
|
|
|
{
|
|
|
|
|
UpdateStep(targetStep);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void InitializeDifficulty()
|
|
|
|
|
{
|
|
|
|
|
foreach (var s in spawners) s.SetActive(false);
|
|
|
|
|
if (rotator != null) rotator.enabled = false;
|
|
|
|
|
|
|
|
|
|
UpdateStep(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UpdateStep(int step)
|
|
|
|
|
{
|
|
|
|
|
currentStep = step;
|
|
|
|
|
switch (step)
|
|
|
|
|
{
|
|
|
|
|
case 1 :
|
|
|
|
|
SetSpawnersActive(2);
|
|
|
|
|
if (rotator != null) rotator.enabled = false;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 2 :
|
|
|
|
|
SetSpawnersActive(4);
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|