DEG-143-세이브-강화-병합 #46
@ -12,6 +12,7 @@ public class PlayerActionAttack : IPlayerAction {
|
||||
[SerializeField] private float comboDuration = 0.7f;
|
||||
private int maxComboStep = 4;
|
||||
|
||||
|
||||
public bool IsActive { get; private set; }
|
||||
public int CurrentComboStep => comboStep;
|
||||
|
||||
@ -35,7 +36,7 @@ public class PlayerActionAttack : IPlayerAction {
|
||||
comboQueued = true;
|
||||
}
|
||||
|
||||
if (comboTimer >= comboDuration) {
|
||||
if (comboTimer >= comboDuration-player.attackSpeedLevel) {
|
||||
ProceedComboOrEnd();
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,12 @@ public class PlayerController : CharacterBase, IObserver<GameObject>
|
||||
private IPlayerState _currentStateClass { get; set; }
|
||||
private IPlayerAction _currentAction;
|
||||
public IPlayerAction CurrentAction => _currentAction;
|
||||
|
||||
// 강화 관련
|
||||
private float attackPowerLevel;
|
||||
private float moveSpeedLevel;
|
||||
private float dashCoolLevel;
|
||||
public float attackSpeedLevel;
|
||||
|
||||
// 상태 관련
|
||||
private PlayerStateIdle _playerStateIdle;
|
||||
@ -49,6 +55,13 @@ public class PlayerController : CharacterBase, IObserver<GameObject>
|
||||
public CharacterController CharacterController => _characterController;
|
||||
public bool IsBattle => _isBattle;
|
||||
public Transform DashEffectAnchor => dashEffectAnchor;
|
||||
|
||||
//대시 쿨타임 관련
|
||||
[SerializeField] private float dashCooldownDuration = 1.5f;
|
||||
private float dashCooldownTimer = 0f;
|
||||
public bool IsDashOnCooldown => dashCooldownTimer > 0f;
|
||||
public float DashCooldownRatio => dashCooldownTimer / dashCooldownDuration;
|
||||
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
@ -72,6 +85,20 @@ public class PlayerController : CharacterBase, IObserver<GameObject>
|
||||
hitEffectController = GetComponentInChildren<PlayerHitEffectController>();
|
||||
|
||||
PlayerInit();
|
||||
|
||||
//강화 수치 적용
|
||||
//attackPowerLevel = 1 + (float)UpgradeManager.Instance.upgradeStat.CurrentUpgradeLevel(StatType.AttackPower) / 2;
|
||||
attackPowerLevel = 1.1f;
|
||||
//moveSpeedLevel = 1 + (float)UpgradeManager.Instance.upgradeStat.CurrentUpgradeLevel(StatType.MoveSpeed) / 2;
|
||||
moveSpeedLevel = 1.1f;
|
||||
//dashCoolLevel = (float)UpgradeManager.Instance.upgradeStat.CurrentUpgradeLevel(StatType.DashCoolDown)/5;
|
||||
dashCoolLevel = 0.2f;
|
||||
//attackSpeedLevel = (float)UpgradeManager.Instance.upgradeStat.CurrentUpgradeLevel(StatType.AttackSpeed)/10;
|
||||
attackSpeedLevel = 0.1f;
|
||||
|
||||
attackPower *= attackPowerLevel;
|
||||
moveSpeed *= moveSpeedLevel;
|
||||
dashCooldownDuration -= dashCoolLevel;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
@ -81,6 +108,10 @@ public class PlayerController : CharacterBase, IObserver<GameObject>
|
||||
_playerStates[CurrentState].Update();
|
||||
}
|
||||
|
||||
//대시 쿨타임 진행
|
||||
if (dashCooldownTimer > 0f)
|
||||
dashCooldownTimer -= Time.deltaTime;
|
||||
|
||||
// Hit 상태거나 게임 끝났을 땐 땐 입력 무시
|
||||
if (CurrentState == PlayerState.Hit || CurrentState == PlayerState.Dead || CurrentState == PlayerState.Win)
|
||||
return;
|
||||
@ -231,6 +262,13 @@ public class PlayerController : CharacterBase, IObserver<GameObject>
|
||||
{
|
||||
if (!_isBattle) return;
|
||||
|
||||
// 쿨타임 중이면 무시
|
||||
if (IsDashOnCooldown)
|
||||
{
|
||||
Debug.Log("대시 쿨타임 중");
|
||||
return;
|
||||
}
|
||||
|
||||
// 만약 공격 중이면 강제로 공격 종료
|
||||
if (_currentAction == _attackAction && _attackAction.IsActive)
|
||||
{
|
||||
@ -244,6 +282,9 @@ public class PlayerController : CharacterBase, IObserver<GameObject>
|
||||
|
||||
_currentAction = _actionDash;
|
||||
_actionDash.StartAction(this);
|
||||
|
||||
// 쿨타임 시작
|
||||
dashCooldownTimer = dashCooldownDuration;
|
||||
}
|
||||
|
||||
public void OnActionEnded(IPlayerAction action)
|
||||
|
BIN
Assets/KJM/KJM.unity
(Stored with Git LFS)
BIN
Assets/KJM/KJM.unity
(Stored with Git LFS)
Binary file not shown.
@ -64,15 +64,15 @@ public class TestScript : MonoBehaviour,ISaveable
|
||||
// heartLevel = save.dungeonSave.heartLevel;
|
||||
// moveSpeedLevel = save.dungeonSave.moveSpeedLevel;
|
||||
// dashCoolDownLevel = save.dungeonSave.dashCoolDownLevel;
|
||||
stageLevel = save.dungeonSave.stageLevel;
|
||||
//stageLevel = save.dungeonSave.stageLevel;
|
||||
}
|
||||
|
||||
if (save?.homeSave != null)
|
||||
{
|
||||
time = save.homeSave.time;
|
||||
currentDay = save.homeSave.currentDay;
|
||||
health = save.homeSave.health;
|
||||
reputation = save.homeSave.reputation;
|
||||
//time = save.homeSave.time;
|
||||
//currentDay = save.homeSave.currentDay;
|
||||
//health = save.homeSave.health;
|
||||
//reputation = save.homeSave.reputation;
|
||||
mealCount = save.homeSave.mealCount;
|
||||
houseworkCount = save.homeSave.houseworkCount;
|
||||
|
||||
@ -95,16 +95,16 @@ public class TestScript : MonoBehaviour,ISaveable
|
||||
// heartLevel = this.heartLevel,
|
||||
// moveSpeedLevel = this.moveSpeedLevel,
|
||||
// dashCoolDownLevel = this.dashCoolDownLevel,
|
||||
stageLevel = this.stageLevel,
|
||||
//stageLevel = this.stageLevel,
|
||||
|
||||
},
|
||||
|
||||
homeSave = new HomeSave
|
||||
{
|
||||
time = this.time,
|
||||
currentDay = this.currentDay,
|
||||
health = this.health,
|
||||
reputation = this.reputation,
|
||||
//time = this.time,
|
||||
//currentDay = this.currentDay,
|
||||
//health = this.health,
|
||||
//reputation = this.reputation,
|
||||
mealCount = this.mealCount,
|
||||
houseworkCount = this.houseworkCount
|
||||
|
||||
}
|
||||
|
BIN
Assets/KJM/KJM_Test/Upgrade/Prefabs/UpgradeTestObject.prefab
(Stored with Git LFS)
Normal file
BIN
Assets/KJM/KJM_Test/Upgrade/Prefabs/UpgradeTestObject.prefab
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e3768143d1fc350408bf60fc9e748b56
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -18,7 +18,6 @@ public enum StatType
|
||||
|
||||
public class UpgradeManager : Singleton<UpgradeManager>
|
||||
{
|
||||
//캔버스 프리팹 사용..?
|
||||
Canvas canvas;
|
||||
|
||||
public GameObject backgroundPanel;
|
||||
@ -157,8 +156,19 @@ public class UpgradeManager : Singleton<UpgradeManager>
|
||||
|
||||
//배경 패널 비활성화
|
||||
StartCoroutine(CoFade(backgroundRectTransform.gameObject, 0.7f,0f,0.2f));
|
||||
|
||||
if (SceneManager.GetActiveScene().name == "ReDungeon")
|
||||
{
|
||||
StartCoroutine(DelayedSceneChange()); // n초 대기 후 전환
|
||||
}
|
||||
}
|
||||
|
||||
//씬 전환 대기 코루틴
|
||||
private IEnumerator DelayedSceneChange()
|
||||
{
|
||||
yield return new WaitForSeconds(2f);
|
||||
GameManager.Instance.ChangeToHomeScene();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 페이드 애니메이션 코루틴
|
||||
@ -232,7 +242,8 @@ public class UpgradeManager : Singleton<UpgradeManager>
|
||||
|
||||
protected override void OnSceneLoaded(Scene scene, LoadSceneMode mode)
|
||||
{
|
||||
|
||||
if(canvas == null)
|
||||
canvas = FindObjectOfType<Canvas>();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -114,8 +114,6 @@ public class DungeonLogic : MonoBehaviour
|
||||
|
||||
// TODO: 강화 시스템으로 넘어가고 일상 맵으로 이동
|
||||
GameManager.Instance.PanelManager.GetPanel("ClearPanelBG");
|
||||
|
||||
StartCoroutine(DelayedSceneChange()); // 5초 대기 후 전환
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,6 +10,27 @@ public class DungeonPanelController : MonoBehaviour
|
||||
[SerializeField] private Image[] _playerHealthImages; // color 값 white / black 로 조정
|
||||
private int _countHealth = 0;
|
||||
|
||||
private int visibleHeartCount = 3; // 강화 레벨로 설정됨
|
||||
|
||||
|
||||
void Start()
|
||||
{
|
||||
jay
commented
전체적으로 주석들은 남긴 이유 같이 위에 적어주시면 좋을 것 같습니다 전체적으로 주석들은 남긴 이유 같이 위에 적어주시면 좋을 것 같습니다
|
||||
//int level = UpgradeManager.Instance.upgradeStat.CurrentUpgradeLevel(StatType.Heart); // 1~3
|
||||
int level = 2;
|
||||
|
||||
visibleHeartCount = 3 + (level - 1); // level 1=3개, 2=4개, 3=5개
|
||||
|
||||
for (int i = 0; i < _playerHealthImages.Length; i++)
|
||||
{
|
||||
var color = _playerHealthImages[i].color;
|
||||
color.a = (i < visibleHeartCount) ? 1f : 0f;
|
||||
color = (i < visibleHeartCount) ? Color.white : new Color(1,1,1,0);
|
||||
_playerHealthImages[i].color = color;
|
||||
}
|
||||
|
||||
_countHealth = 0;
|
||||
}
|
||||
|
||||
public void SetBossHealthBar(float hp) // hp: 0~300
|
||||
{
|
||||
float normalizedHp = hp / 300f; // 0~1 사이 값으로 조정
|
||||
@ -21,15 +42,15 @@ public class DungeonPanelController : MonoBehaviour
|
||||
{
|
||||
StartCoroutine(WaitForOneSecond());
|
||||
// out of index error 방지
|
||||
if (_countHealth > _playerHealthImages.Length - 1) return false;
|
||||
if (_countHealth >= visibleHeartCount) return false;
|
||||
|
||||
_playerHealthImages[_countHealth].color = Color.black;
|
||||
_countHealth++;
|
||||
return _countHealth <= _playerHealthImages.Length - 1;
|
||||
return _countHealth < visibleHeartCount;
|
||||
}
|
||||
|
||||
IEnumerator WaitForOneSecond()
|
||||
{
|
||||
yield return new WaitForSeconds(1.0f);
|
||||
}
|
||||
}
|
||||
}
|
@ -5,7 +5,7 @@ using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
public class PlayerStats : MonoBehaviour
|
||||
public class PlayerStats : MonoBehaviour, ISaveable
|
||||
{
|
||||
public class StatsChangeData // 변경된 스탯 데이터
|
||||
{
|
||||
@ -385,4 +385,31 @@ public class PlayerStats : MonoBehaviour
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void ApplySaveData(Save save)
|
||||
{
|
||||
if (save?.homeSave != null)
|
||||
{
|
||||
TimeStat = save.homeSave.time;
|
||||
HealthStat = save.homeSave.health;
|
||||
ReputationStat = save.homeSave.reputation;
|
||||
//mealCount = save.homeSave.mealCount;
|
||||
//houseworkCount = save.homeSave.houseworkCount;
|
||||
}
|
||||
}
|
||||
|
||||
public Save ExtractSaveData()
|
||||
{
|
||||
return new Save
|
||||
{
|
||||
homeSave = new HomeSave
|
||||
{
|
||||
time = this.TimeStat,
|
||||
health = this.HealthStat,
|
||||
reputation = this.ReputationStat,
|
||||
//mealCount = this.mealCount,
|
||||
//houseworkCount = this.houseworkCount
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
BIN
Assets/KSH/ReDungeon.unity
(Stored with Git LFS)
BIN
Assets/KSH/ReDungeon.unity
(Stored with Git LFS)
Binary file not shown.
BIN
Assets/KSH/ReHousing.unity
(Stored with Git LFS)
BIN
Assets/KSH/ReHousing.unity
(Stored with Git LFS)
Binary file not shown.
@ -61,5 +61,6 @@ public class ClearPanelController : PanelController, IPointerClickHandler
|
||||
{
|
||||
onCompleted?.Invoke();
|
||||
Hide();
|
||||
UpgradeManager.Instance.StartUpgrade();
|
||||
}
|
||||
}
|
@ -4,7 +4,7 @@ using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public partial class GameManager : Singleton<GameManager>
|
||||
public partial class GameManager : Singleton<GameManager>, ISaveable
|
||||
{
|
||||
// 게임 진행 상태
|
||||
private int currentDay = 1; // 날짜
|
||||
@ -109,4 +109,33 @@ public partial class GameManager : Singleton<GameManager>
|
||||
{
|
||||
// TODO: 게임 종료 시 로직 추가
|
||||
}
|
||||
|
||||
public void ApplySaveData(Save save)
|
||||
{
|
||||
if (save?.dungeonSave != null)
|
||||
{
|
||||
stageLevel = save.dungeonSave.stageLevel;
|
||||
}
|
||||
|
||||
if (save?.homeSave != null)
|
||||
{
|
||||
currentDay = save.homeSave.currentDay;
|
||||
}
|
||||
}
|
||||
|
||||
public Save ExtractSaveData()
|
||||
{
|
||||
return new Save
|
||||
{
|
||||
dungeonSave = new DungeonSave()
|
||||
{
|
||||
stageLevel = this.stageLevel,
|
||||
},
|
||||
|
||||
homeSave = new HomeSave
|
||||
{
|
||||
currentDay = this.currentDay,
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user
저희 집안일 제한은 현재 없는 상태라(figma 참고) 집안일 횟수 제한 관련 변수는 삭제하셔도 괜찮을 것 같습니다!
또 궁금한게 저희가 엔딩이 나면 세이브는 어떻게 처리되나요? 모든 값 초기화인가요 아니면 저장 값이 유지되나요?
흠 물론 프로토타입이라 가볍게 생각해도 괜찮을 듯 합니다