2026-06-01 데드존 만들기 진행중
This commit is contained in:
@@ -10,6 +10,8 @@ public class GameManager : MonoBehaviour,ISceneInitializable
|
||||
|
||||
public WaveManager WaveM {get; private set;}
|
||||
|
||||
public RestartUI Restart {get; private set;}
|
||||
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
@@ -28,5 +30,11 @@ public void OnSceneLoaded()
|
||||
SkillSupporter = Object.FindFirstObjectByType<SkillSupport>();
|
||||
LocalPlayer = Object.FindFirstObjectByType<PlayerController>();
|
||||
WaveM = Object.FindFirstObjectByType<WaveManager>();
|
||||
Restart = Object.FindFirstObjectByType<RestartUI>();
|
||||
}
|
||||
|
||||
public void GameRestart()
|
||||
{
|
||||
Debug.Log("다시시작");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1775,5 +1775,16 @@ public void TakeDamage(int amount, Vector2 hitVelocity = default, string hitReac
|
||||
|
||||
_health.TakeDamage(amount);
|
||||
Debug.Log($"{name} 피격: -{amount} (HP: {_health.CurrentHealth}/{_health.MaxHealth})");
|
||||
|
||||
if(_health.CurrentHealth <= 0)
|
||||
{
|
||||
PlayerDead();
|
||||
}
|
||||
}
|
||||
|
||||
public void PlayerDead()
|
||||
{
|
||||
//재시작 UI 띄우기
|
||||
GameManager.Instance.Restart.ShowRestart();
|
||||
}
|
||||
}
|
||||
|
||||
18
Assets/02_Scripts/UI/RestartUI.cs
Normal file
18
Assets/02_Scripts/UI/RestartUI.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class RestartUI : MonoBehaviour
|
||||
{
|
||||
[SerializeField] GameObject RestartRoot;
|
||||
[SerializeField] Button RestartButton;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
RestartButton.onClick.AddListener(()=>GameManager.Instance.GameRestart());
|
||||
}
|
||||
|
||||
public void ShowRestart()
|
||||
{
|
||||
RestartRoot.SetActive(true);
|
||||
}
|
||||
}
|
||||
2
Assets/02_Scripts/UI/RestartUI.cs.meta
Normal file
2
Assets/02_Scripts/UI/RestartUI.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6f1fff5578632d94a8da5d5b817993ad
|
||||
8
Assets/02_Scripts/Zone.meta
Normal file
8
Assets/02_Scripts/Zone.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2d9190260bedb76469ecb2e74a484e34
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
14
Assets/02_Scripts/Zone/DeadZone.cs
Normal file
14
Assets/02_Scripts/Zone/DeadZone.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class DeadZone : MonoBehaviour
|
||||
{
|
||||
private void OnTriggerEnter2D(Collider2D other)
|
||||
{
|
||||
if(other.GetComponentInParent<PlayerController>() != null)
|
||||
{
|
||||
PlayerController p = other.GetComponentInParent<PlayerController>();
|
||||
|
||||
p.TakeDamage(9999999);
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/02_Scripts/Zone/DeadZone.cs.meta
Normal file
2
Assets/02_Scripts/Zone/DeadZone.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f04acdf6d5c2075499cc53d22714d058
|
||||
Reference in New Issue
Block a user