2026-04-02 타임라인 (진행중)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Unity.VisualScripting;
|
||||
using Unity.VisualScripting.Antlr3.Runtime.Misc;
|
||||
using UnityEngine;
|
||||
@@ -245,8 +246,9 @@ public async Awaitable<bool> AddItemAsync(ItemInstance item)
|
||||
// 원래 item의 수량을 조절해서 보냄
|
||||
item.CurrentStack = actualAmountToTake;
|
||||
|
||||
// bool serverResult = await DataManager.Instance.SaveItemToServer(item);
|
||||
await Task.Yield(); //임시코드
|
||||
bool serverResult = true; // 테스트용
|
||||
// bool serverResult = await DataManager.Instance.SaveItemToServer(item);
|
||||
|
||||
// 서버 저장 성공 시에만 실제 로컬 배열에 데이터 기입
|
||||
if (serverResult)
|
||||
|
||||
@@ -15,21 +15,15 @@ public void OnSceneLoaded(Scene scene, LoadSceneMode mode)
|
||||
|
||||
public void ItemUse(ItemInstance item)
|
||||
{
|
||||
Debug.Log("아이템 사용");
|
||||
|
||||
switch(item.Data.ItemEffectType)
|
||||
{
|
||||
case ItemEffectType.RECOVERY_HP:
|
||||
{
|
||||
Debug.Log($"전 HP : {GameManager.Instance.Level.CurrentCharacter.GetComponent<Health>().CurrentHP}");
|
||||
RecoveryHPHealthEffect(GameManager.Instance.Level.CurrentCharacter.GetComponent<Health>(), item.Data.RecoveryHP, item.Data.ItemEffectVisual);
|
||||
Debug.Log($"후 HP : {GameManager.Instance.Level.CurrentCharacter.GetComponent<Health>().CurrentHP}");
|
||||
}
|
||||
break;
|
||||
case ItemEffectType.INTERVAL_DAMAGE:
|
||||
{
|
||||
Debug.Log("틱데미지 아이템 타입임");
|
||||
|
||||
IntervalDamageHealthEffect(GameManager.Instance.Level.CurrentCharacter.GetComponent<Health>(), item.Data.IntervalDamage, item.Data.IntervalDamageTime, item.Data.ItemEffectVisual);
|
||||
}
|
||||
break;
|
||||
@@ -65,20 +59,13 @@ public async void IntervalDamage(Health health, float damage,float time, GameObj
|
||||
|
||||
float tickDamage = damage / time;
|
||||
|
||||
Debug.Log($"damage: {damage}");
|
||||
Debug.Log($"time: {time}");
|
||||
Debug.Log($"tickDamage: {tickDamage}");
|
||||
Debug.Log($"CurrentHP : {health.CurrentHP}");
|
||||
|
||||
try
|
||||
{
|
||||
while (time > 0)
|
||||
{
|
||||
Debug.Log($"진입");
|
||||
health.ChangeHP(health.CurrentHP - Mathf.FloorToInt(tickDamage)); //소수점 전부 버림
|
||||
if (health.CurrentHP <= 0) break;
|
||||
time--;
|
||||
Debug.Log($"중독 HP : {GameManager.Instance.Level.CurrentCharacter.GetComponent<Health>().CurrentHP}");
|
||||
await Task.Delay(1000, token);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
public class InGameUIManager : BaseUIManager
|
||||
{
|
||||
public UserHealthUI UserHealth;
|
||||
public InteractionUI Interaction;
|
||||
public SplitWindowUI SplitWindow;
|
||||
public TooltipUI Tooltip;
|
||||
|
||||
@@ -121,6 +121,11 @@ private void Start()
|
||||
SetCursorLockState(true);
|
||||
}
|
||||
|
||||
public void PlayerStart()
|
||||
{
|
||||
Debug.Log("플레이 시작!!");
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
//캐릭터 컨트롤러는 FixedUpdate보다 Update에서 하는게 권장됨
|
||||
@@ -134,9 +139,6 @@ private void Update()
|
||||
|
||||
TickTimer();
|
||||
//PlayerDebug();
|
||||
|
||||
|
||||
Debug.Log($"InteractionTargetsCount : {InteractionTargets.Count}");
|
||||
}
|
||||
|
||||
private void FixedUpdate()
|
||||
|
||||
@@ -1,15 +1,34 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class PlayerHealth : Health
|
||||
{
|
||||
[SerializeField] PlayerStat _pstat;
|
||||
|
||||
public Image UI_HPBar { get; private set; }
|
||||
public Image UI_MPBar { get; private set; }
|
||||
public Image UI_StaminaBar { get; private set; }
|
||||
|
||||
public PlayerStat Pstat { get { return _pstat; } }
|
||||
|
||||
void Start()
|
||||
private void Awake()
|
||||
{
|
||||
_pstat = GetComponent<PlayerStat>();
|
||||
currentHp = _pstat.MaxHp; // 스태틱 데이터를 가져와 초기화
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
maxHp = _pstat.MaxHp;
|
||||
currentHp = _pstat.MaxHp;
|
||||
|
||||
UI_HPBar = GameManager.Instance.InGameUI.UserHealth.UI_HPBar;
|
||||
UI_MPBar = GameManager.Instance.InGameUI.UserHealth.UI_MPBar;
|
||||
UI_StaminaBar = GameManager.Instance.InGameUI.UserHealth.UI_StaminaBar;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
UI_HPBar.fillAmount = (float)currentHp / (float)maxHp;
|
||||
}
|
||||
|
||||
public void TakeDamage(int damage)
|
||||
|
||||
8
Assets/02_Scripts/UI/Health.meta
Normal file
8
Assets/02_Scripts/UI/Health.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e1cab689eef132148a28349a68b53300
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
12
Assets/02_Scripts/UI/Health/UserHealthUI.cs
Normal file
12
Assets/02_Scripts/UI/Health/UserHealthUI.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class UserHealthUI : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private Image _ui_HPBar;
|
||||
[SerializeField] private Image _ui_MPBar;
|
||||
[SerializeField] private Image _ui_StaminaBar;
|
||||
public Image UI_HPBar { get { return _ui_HPBar; } private set { _ui_HPBar = value; } }
|
||||
public Image UI_MPBar { get { return _ui_MPBar; } private set { _ui_MPBar = value; } }
|
||||
public Image UI_StaminaBar { get { return _ui_StaminaBar; } private set { _ui_StaminaBar = value; } }
|
||||
}
|
||||
2
Assets/02_Scripts/UI/Health/UserHealthUI.cs.meta
Normal file
2
Assets/02_Scripts/UI/Health/UserHealthUI.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 014ee681cdfcb10419634aa9b5ce429b
|
||||
@@ -37,7 +37,6 @@ private void Start()
|
||||
{
|
||||
if (currentItem != null)
|
||||
SetItem(currentItem);
|
||||
|
||||
}
|
||||
|
||||
public void ClearSlot()
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
|
||||
public class Health : MonoBehaviour
|
||||
{
|
||||
protected int maxHp;
|
||||
protected int currentHp;
|
||||
|
||||
public int CurrentHP { get { return currentHp; } }
|
||||
|
||||
public void ChangeHP(int newHp)
|
||||
|
||||
Reference in New Issue
Block a user