DEG-165-세이브-강화-버그수정 #64
@ -5,6 +5,7 @@ using System.Runtime.CompilerServices;
|
|||||||
using UnityEditor.TextCore.Text;
|
using UnityEditor.TextCore.Text;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
public enum PlayerState { None, Idle, Move, Win, Hit, Dead }
|
public enum PlayerState { None, Idle, Move, Win, Hit, Dead }
|
||||||
|
|
||||||
@ -17,6 +18,7 @@ public class PlayerController : CharacterBase, IObserver<GameObject>
|
|||||||
[SerializeField] private GameObject normalModel; // char_body : 일상복
|
[SerializeField] private GameObject normalModel; // char_body : 일상복
|
||||||
[SerializeField] private GameObject battleModel; // warrior_1 : 전투복
|
[SerializeField] private GameObject battleModel; // warrior_1 : 전투복
|
||||||
[SerializeField] private Transform dashEffectAnchor; // 대시 이펙트 위치
|
[SerializeField] private Transform dashEffectAnchor; // 대시 이펙트 위치
|
||||||
|
[SerializeField] private Image dashCooldownFillImage; //대시 쿨다운 이미지
|
||||||
|
|
||||||
// 내부에서만 사용하는 변수
|
// 내부에서만 사용하는 변수
|
||||||
private PlayerHitEffectController hitEffectController;
|
private PlayerHitEffectController hitEffectController;
|
||||||
@ -108,7 +110,16 @@ public class PlayerController : CharacterBase, IObserver<GameObject>
|
|||||||
|
|
||||||
//대시 쿨타임 진행
|
//대시 쿨타임 진행
|
||||||
if (dashCooldownTimer > 0f)
|
if (dashCooldownTimer > 0f)
|
||||||
|
{
|
||||||
dashCooldownTimer -= Time.deltaTime;
|
dashCooldownTimer -= Time.deltaTime;
|
||||||
|
if(dashCooldownFillImage != null)
|
||||||
|
dashCooldownFillImage.fillAmount = DashCooldownRatio;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(dashCooldownFillImage != null)
|
||||||
|
dashCooldownFillImage.fillAmount = 0f;
|
||||||
|
}
|
||||||
|
|
||||||
// Hit 상태거나 게임 끝났을 땐 땐 입력 무시
|
// Hit 상태거나 게임 끝났을 땐 땐 입력 무시
|
||||||
if (CurrentState == PlayerState.Hit || CurrentState == PlayerState.Dead || CurrentState == PlayerState.Win)
|
if (CurrentState == PlayerState.Hit || CurrentState == PlayerState.Dead || CurrentState == PlayerState.Win)
|
||||||
|
@ -15,6 +15,9 @@ public class DungeonSave
|
|||||||
// 현재 진행 중인 스테이지
|
// 현재 진행 중인 스테이지
|
||||||
public int stageLevel = 0;
|
public int stageLevel = 0;
|
||||||
|
|
||||||
|
// 스테이지 도전 횟수
|
||||||
|
public int tryStageCount = 999;
|
||||||
|
|
||||||
//병합을 위한 메서드
|
//병합을 위한 메서드
|
||||||
public void MergeWith(DungeonSave other)
|
public void MergeWith(DungeonSave other)
|
||||||
{
|
{
|
||||||
@ -26,6 +29,7 @@ public class DungeonSave
|
|||||||
if (other.moveSpeedLevel != 0) moveSpeedLevel = other.moveSpeedLevel;
|
if (other.moveSpeedLevel != 0) moveSpeedLevel = other.moveSpeedLevel;
|
||||||
if (other.dashCoolDownLevel != 0) dashCoolDownLevel = other.dashCoolDownLevel;
|
if (other.dashCoolDownLevel != 0) dashCoolDownLevel = other.dashCoolDownLevel;
|
||||||
if (other.stageLevel != 0) stageLevel = other.stageLevel;
|
if (other.stageLevel != 0) stageLevel = other.stageLevel;
|
||||||
|
if (other.tryStageCount < 999) tryStageCount = other.tryStageCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,6 +49,16 @@ public class HomeSave
|
|||||||
//이벤트
|
//이벤트
|
||||||
public int mealCount = 999;
|
public int mealCount = 999;
|
||||||
|
|
||||||
|
public bool hasShownBubbleToday = false;
|
||||||
|
public bool hasShownBubbleTodaySet = false;
|
||||||
|
|
||||||
|
public bool hasCheckedAbsenceToday;
|
||||||
|
public bool hasCheckedAbsenceTodaySet = false;
|
||||||
|
|
||||||
|
//튜토리얼 여부
|
||||||
|
public bool hasTutorial = false;
|
||||||
|
public bool hasTutorialSet = false;
|
||||||
|
|
||||||
//병합을 위한 메서드
|
//병합을 위한 메서드
|
||||||
public void MergeWith(HomeSave other)
|
public void MergeWith(HomeSave other)
|
||||||
{
|
{
|
||||||
@ -55,6 +69,12 @@ public class HomeSave
|
|||||||
if (other.health < 999) health = other.health;
|
if (other.health < 999) health = other.health;
|
||||||
if (other.reputation < 999) reputation = other.reputation;
|
if (other.reputation < 999) reputation = other.reputation;
|
||||||
if (other.mealCount < 999) mealCount = other.mealCount;
|
if (other.mealCount < 999) mealCount = other.mealCount;
|
||||||
|
|
||||||
|
if (other.hasShownBubbleTodaySet) hasShownBubbleToday = other.hasShownBubbleToday;
|
||||||
|
|
||||||
|
if (other.hasCheckedAbsenceTodaySet) hasCheckedAbsenceToday = other.hasCheckedAbsenceToday;
|
||||||
|
|
||||||
|
if (other.hasTutorialSet) hasTutorial = other.hasTutorial;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,6 +85,7 @@ public class Save
|
|||||||
public HomeSave homeSave;
|
public HomeSave homeSave;
|
||||||
public DungeonSave dungeonSave;
|
public DungeonSave dungeonSave;
|
||||||
|
|
||||||
|
//초기 값 반환
|
||||||
public Save InitSave()
|
public Save InitSave()
|
||||||
{
|
{
|
||||||
return new Save
|
return new Save
|
||||||
@ -75,7 +96,10 @@ public class Save
|
|||||||
time = 8.0f,
|
time = 8.0f,
|
||||||
health = 8.0f,
|
health = 8.0f,
|
||||||
reputation = 2.0f,
|
reputation = 2.0f,
|
||||||
mealCount = 0
|
mealCount = 0,
|
||||||
|
hasShownBubbleToday = false,
|
||||||
|
hasCheckedAbsenceToday = false,
|
||||||
|
hasTutorial = false
|
||||||
},
|
},
|
||||||
dungeonSave = new DungeonSave
|
dungeonSave = new DungeonSave
|
||||||
{
|
{
|
||||||
@ -84,7 +108,8 @@ public class Save
|
|||||||
heartLevel = 1,
|
heartLevel = 1,
|
||||||
moveSpeedLevel = 1,
|
moveSpeedLevel = 1,
|
||||||
dashCoolDownLevel = 1,
|
dashCoolDownLevel = 1,
|
||||||
stageLevel = 1
|
stageLevel = 1,
|
||||||
|
tryStageCount = 0
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -46,9 +46,6 @@ public class SaveManager : Singleton<SaveManager>
|
|||||||
backupSave = LoadBackup();
|
backupSave = LoadBackup();
|
||||||
|
|
||||||
saveDataController.ApplySaveData(mainSave);
|
saveDataController.ApplySaveData(mainSave);
|
||||||
|
|
||||||
Debug.Log("메인 로드" + mainSave.homeSave.reputation); //임시 코드
|
|
||||||
Debug.Log("백업 로드" + backupSave.homeSave.reputation); //임시 코드
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateSaveInfo()
|
private void UpdateSaveInfo()
|
||||||
@ -187,7 +184,7 @@ public class SaveManager : Singleton<SaveManager>
|
|||||||
backupSave = fresh.InitSave();
|
backupSave = fresh.InitSave();
|
||||||
SaveMain();
|
SaveMain();
|
||||||
SaveBackup();
|
SaveBackup();
|
||||||
saveDataController.ApplySaveData(fresh);
|
saveDataController.ApplySaveData(mainSave);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,6 +31,8 @@ public class UpgradeManager : Singleton<UpgradeManager>
|
|||||||
private RectTransform backgroundRectTransform;
|
private RectTransform backgroundRectTransform;
|
||||||
private List<Button> cards = new List<Button>();
|
private List<Button> cards = new List<Button>();
|
||||||
|
|
||||||
|
private bool isHome = false;
|
||||||
|
|
||||||
public void Start()
|
public void Start()
|
||||||
{
|
{
|
||||||
if(canvas == null)
|
if(canvas == null)
|
||||||
@ -83,6 +85,36 @@ public class UpgradeManager : Singleton<UpgradeManager>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 랜덤한 강화 카드 1장
|
||||||
|
/// </summary>
|
||||||
|
public void StartUpgradeInHome()
|
||||||
|
{
|
||||||
|
isHome = true;
|
||||||
|
|
||||||
|
DrawStatNumber();
|
||||||
|
|
||||||
|
//배경 패널 생성
|
||||||
|
if(backgroundRectTransform == null)
|
||||||
|
backgroundRectTransform = Instantiate(backgroundPanel,canvas.transform).GetComponent<RectTransform>();
|
||||||
|
//배경 패널 애니메이션 적용
|
||||||
|
backgroundRectTransform.gameObject.SetActive(true);
|
||||||
|
StartCoroutine(CoFade(backgroundRectTransform.gameObject, 0f,0.7f,0.2f));
|
||||||
|
|
||||||
|
EnsureCardListSize(3);
|
||||||
|
|
||||||
|
if(cards[0] == null)
|
||||||
|
cards[0] = Instantiate(upgradeButton, backgroundRectTransform);
|
||||||
|
|
||||||
|
cards[0].gameObject.SetActive(true);
|
||||||
|
cards[0].GetComponent<UpgradeCard>().Init((StatType)stats[0]);
|
||||||
|
StartCoroutine(CoFade(cards[0].gameObject, 0f,1f,0.4f, () =>
|
||||||
|
{
|
||||||
|
cards[0].GetComponent<CanvasGroup>().interactable = true;
|
||||||
|
}));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 중복되지 않는 랜덤한 스탯 번호 뽑기
|
/// 중복되지 않는 랜덤한 스탯 번호 뽑기
|
||||||
@ -130,13 +162,15 @@ public class UpgradeManager : Singleton<UpgradeManager>
|
|||||||
public void DestroyUpgradeCard()
|
public void DestroyUpgradeCard()
|
||||||
{
|
{
|
||||||
// 카드 비활성화
|
// 카드 비활성화
|
||||||
if (stats.Count == 0)
|
if (stats.Count == 0|| isHome)
|
||||||
{
|
{
|
||||||
StartCoroutine(CoFade(cards[0].gameObject, 1f,0f,0.4f,() =>
|
StartCoroutine(CoFade(cards[0].gameObject, 1f,0f,0.4f,() =>
|
||||||
{
|
{
|
||||||
cards[0].gameObject.SetActive(false);
|
cards[0].gameObject.SetActive(false);
|
||||||
backgroundRectTransform.gameObject.SetActive(false);
|
backgroundRectTransform.gameObject.SetActive(false);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
isHome = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -189,7 +223,7 @@ public class UpgradeManager : Singleton<UpgradeManager>
|
|||||||
|
|
||||||
if (canvasGroup == null && image == null)
|
if (canvasGroup == null && image == null)
|
||||||
{
|
{
|
||||||
Debug.LogError("CanvasGroup도 Image도 없습니다!");
|
Debug.LogError("CanvasGroup도 Image도 없습니다");
|
||||||
yield break;
|
yield break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +87,6 @@ public class UpgradeStat : MonoBehaviour, ISaveable
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Save ExtractSaveData()
|
public Save ExtractSaveData()
|
||||||
{
|
{
|
||||||
Debug.Log("UpgradeStat extracting save data");
|
|
||||||
return new Save
|
return new Save
|
||||||
{
|
{
|
||||||
dungeonSave = new DungeonSave
|
dungeonSave = new DungeonSave
|
||||||
|
@ -46,7 +46,7 @@ public class DungeonPanelController : MonoBehaviour
|
|||||||
// out of index error 방지
|
// out of index error 방지
|
||||||
if (_countHealth >= visibleHeartCount) return false;
|
if (_countHealth >= visibleHeartCount) return false;
|
||||||
|
|
||||||
_playerHealthImages[_countHealth].color = Color.black;
|
_playerHealthImages[visibleHeartCount-(_countHealth+1)].color = Color.black;
|
||||||
|
|||||||
_countHealth++;
|
_countHealth++;
|
||||||
return _countHealth < visibleHeartCount;
|
return _countHealth < visibleHeartCount;
|
||||||
}
|
}
|
||||||
|
@ -416,6 +416,11 @@ public class PlayerStats : MonoBehaviour,ISaveable
|
|||||||
HealthStat = Mathf.Clamp(save.homeSave.health, 0, _gameConstants.maxHealth);
|
HealthStat = Mathf.Clamp(save.homeSave.health, 0, _gameConstants.maxHealth);
|
||||||
ReputationStat = Mathf.Clamp(save.homeSave.reputation, 0, _gameConstants.maxReputation);
|
ReputationStat = Mathf.Clamp(save.homeSave.reputation, 0, _gameConstants.maxReputation);
|
||||||
_mealCount = Mathf.Clamp(save.homeSave.mealCount, 0, 2);
|
_mealCount = Mathf.Clamp(save.homeSave.mealCount, 0, 2);
|
||||||
|
_hasCheckedAbsenceToday = save.homeSave.hasCheckedAbsenceToday;
|
||||||
|
_hasShownBubbleToday = save.homeSave.hasShownBubbleToday;
|
||||||
|
|
||||||
|
//UI적용
|
||||||
|
OnStatsChanged?.Invoke(new StatsChangeData(TimeStat, HealthStat, ReputationStat));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -428,7 +433,13 @@ public class PlayerStats : MonoBehaviour,ISaveable
|
|||||||
time = Mathf.Clamp(this.TimeStat,0,_gameConstants.maxTime),
|
time = Mathf.Clamp(this.TimeStat,0,_gameConstants.maxTime),
|
||||||
health = Mathf.Clamp(this.HealthStat,0,_gameConstants.maxHealth),
|
health = Mathf.Clamp(this.HealthStat,0,_gameConstants.maxHealth),
|
||||||
reputation = Mathf.Clamp(this.ReputationStat,0,_gameConstants.maxReputation),
|
reputation = Mathf.Clamp(this.ReputationStat,0,_gameConstants.maxReputation),
|
||||||
mealCount = Mathf.Clamp(this._mealCount,0,2)
|
mealCount = Mathf.Clamp(this._mealCount,0,2),
|
||||||
|
|
||||||
|
hasCheckedAbsenceTodaySet = true,
|
||||||
|
hasCheckedAbsenceToday = this._hasCheckedAbsenceToday,
|
||||||
|
|
||||||
|
hasShownBubbleTodaySet = true,
|
||||||
|
hasShownBubbleToday = this._hasShownBubbleToday,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
BIN
Assets/KSH/ReDungeon.unity
(Stored with Git LFS)
BIN
Assets/KSH/ReDungeon.unity
(Stored with Git LFS)
Binary file not shown.
@ -5,6 +5,7 @@ using System.Text;
|
|||||||
using TMPro;
|
using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
using Random = UnityEngine.Random;
|
||||||
|
|
||||||
public class InteractionAnimationPanelController : MonoBehaviour
|
public class InteractionAnimationPanelController : MonoBehaviour
|
||||||
{
|
{
|
||||||
@ -108,6 +109,16 @@ public class InteractionAnimationPanelController : MonoBehaviour
|
|||||||
//패널 닫고 애니메이션 null처리
|
//패널 닫고 애니메이션 null처리
|
||||||
HidePanel();
|
HidePanel();
|
||||||
_autoHideCoroutine = null;
|
_autoHideCoroutine = null;
|
||||||
|
|
||||||
|
if (actionType == ActionType.Housework)
|
||||||
|
{
|
||||||
|
var chance = 0.7f;
|
||||||
|
|
||||||
|
if (Random.value < chance)
|
||||||
|
{
|
||||||
|
UpgradeManager.Instance.StartUpgradeInHome();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HidePanel()
|
private void HidePanel()
|
||||||
|
@ -133,6 +133,7 @@ public partial class GameManager : Singleton<GameManager>,ISaveable
|
|||||||
if (save?.dungeonSave != null)
|
if (save?.dungeonSave != null)
|
||||||
{
|
{
|
||||||
stageLevel = Mathf.Clamp(save.dungeonSave.stageLevel,1,2);
|
stageLevel = Mathf.Clamp(save.dungeonSave.stageLevel,1,2);
|
||||||
|
tryStageCount = Mathf.Clamp(save.dungeonSave.tryStageCount,0,3);
|
||||||
Sehyeon
commented
음 참고로 저희가 tryStageCount 가 3이 되면 바로 엔딩 처리가 되기 때문에 실제로는 0~2 값이 들어갑니다! 음 참고로 저희가 tryStageCount 가 3이 되면 바로 엔딩 처리가 되기 때문에 실제로는 0~2 값이 들어갑니다!
안바꾸셔도 상관은 없는 부분이지만 혹시 몰라 적겠습니다..ㅎㅎ
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (save?.homeSave != null)
|
if (save?.homeSave != null)
|
||||||
@ -148,6 +149,7 @@ public partial class GameManager : Singleton<GameManager>,ISaveable
|
|||||||
dungeonSave = new DungeonSave()
|
dungeonSave = new DungeonSave()
|
||||||
{
|
{
|
||||||
stageLevel = Mathf.Clamp(this.stageLevel,1,2),
|
stageLevel = Mathf.Clamp(this.stageLevel,1,2),
|
||||||
|
tryStageCount = Mathf.Clamp(this.tryStageCount,0,3),
|
||||||
},
|
},
|
||||||
|
|
||||||
homeSave = new HomeSave
|
homeSave = new HomeSave
|
||||||
|
@ -23,11 +23,17 @@ public partial class GameManager
|
|||||||
private void ZeroReputationEnd() // 평판 0 엔딩
|
private void ZeroReputationEnd() // 평판 0 엔딩
|
||||||
{
|
{
|
||||||
StartNPCDialogue(GamePhase.ZeroEnd);
|
StartNPCDialogue(GamePhase.ZeroEnd);
|
||||||
|
|
||||||
|
//세이브 초기화
|
||||||
|
SaveManager.Instance.ResetSave();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FailEnd() // 같은 스테이지 3회 도전 실패 엔딩
|
private void FailEnd() // 같은 스테이지 3회 도전 실패 엔딩
|
||||||
{
|
{
|
||||||
StartNPCDialogue(GamePhase.FailEnd);
|
StartNPCDialogue(GamePhase.FailEnd);
|
||||||
|
|
||||||
|
//세이브 초기화
|
||||||
|
SaveManager.Instance.ResetSave();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 회고 엔딩. 7일차에 실행
|
// 회고 엔딩. 7일차에 실행
|
||||||
@ -35,5 +41,8 @@ public partial class GameManager
|
|||||||
{
|
{
|
||||||
// npc와의 마지막 대화 출력
|
// npc와의 마지막 대화 출력
|
||||||
StartNPCDialogue(GamePhase.End);
|
StartNPCDialogue(GamePhase.End);
|
||||||
|
|
||||||
|
//세이브 초기화
|
||||||
|
SaveManager.Instance.ResetSave();
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user
아하.. 이 코드 때문에 하트가 왼쪽부터 닳은건가요?? 지금은 오른쪽부터로 하셨군요 감사합니다