using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; using Random = UnityEngine.Random; /// /// 테스트용 임시 클래스 /// public class TestScript : MonoBehaviour,ISaveable { //던전 private int attackPowerLevel; private int attackSpeedLevel; private int heartLevel; private int moveSpeedLevel; private int dashCoolDownLevel; private int stageLevel; //일상 private float time; private int currentDay; private float health; private float reputation; private int mealCount; private int houseworkCount; /// /// 스탯값 랜덤 변화 /// public void ChangeValue() { float floatValue = Random.Range(0f, 2f); int intValue = Random.Range(0, 10); attackPowerLevel = intValue; attackSpeedLevel = intValue; heartLevel = intValue; moveSpeedLevel = intValue; stageLevel = intValue; time = floatValue; currentDay = intValue; health = floatValue; reputation = floatValue; mealCount = intValue; houseworkCount = intValue; Debug.Log("ChangeValue : " + floatValue); } /// /// 인터페이스 함수1, 데이터 불러오기 /// /// public void ApplySaveData(Save save) { if (save?.dungeonSave != null) { attackPowerLevel = save.dungeonSave.attackPowerLevel; attackSpeedLevel = save.dungeonSave.attackSpeedLevel; heartLevel = save.dungeonSave.heartLevel; moveSpeedLevel = save.dungeonSave.moveSpeedLevel; dashCoolDownLevel = save.dungeonSave.dashCoolDownLevel; stageLevel = save.dungeonSave.stageLevel; } if (save?.homeSave != null) { time = save.homeSave.time; currentDay = save.homeSave.currentDay; health = save.homeSave.health; reputation = save.homeSave.reputation; mealCount = save.homeSave.mealCount; houseworkCount = save.homeSave.houseworkCount; Debug.Log("ApplySaveData : " + reputation); } } /// /// 인터페이스 함수2, 데이터 전달 /// /// public Save ExtractSaveData() { return new Save { dungeonSave = new DungeonSave() { attackPowerLevel = this.attackPowerLevel, attackSpeedLevel = this.attackSpeedLevel, heartLevel = this.heartLevel, moveSpeedLevel = this.moveSpeedLevel, dashCoolDownLevel = this.dashCoolDownLevel, stageLevel = this.stageLevel, }, homeSave = new HomeSave { time = this.time, currentDay = this.currentDay, health = this.health, reputation = this.reputation, mealCount = this.mealCount, houseworkCount = this.houseworkCount } }; } /// /// 씬 전환 테스트용 함수 /// public void SceneChange() { SceneManager.LoadScene("Main"); } }