public void submit() { myData.PlayerName = name.text; Debug.Log(name.text); myData.FirstTimePlaying = false; DataLogicNew.Save(myData); SceneManager.LoadScene("menu"); }
public void resetGame() { myData.FirstTimePlaying = true; // DataLogic.SaveGameData(myData); myData.StartDate = System.DateTime.Now.ToString(); myData.CurrentDate = System.DateTime.Now.ToString(); DataLogicNew.Save(myData); SceneManager.LoadScene("initializeGame"); }
// Start is called before the first frame update void Start() { int expGained = questConstants.questTime * PlayerPrefs.GetInt("difficulty"); type.text = "Quest Type: " + questConstants.questType; time.text = "Time Spent: " + questConstants.questTime; exp.text = "Exp gained: +" + expGained; //Data update logic DataObject myData = new DataObject(); myData = DataLogicNew.Load(); if (questConstants.questType == "Strength") { story.text = myData.PostStrengthQuestLine[myData.DayCounter]; myData.StrengthEXP += expGained; myData.DailyStrengthEXP[myData.DayCounter] += expGained; } else if (questConstants.questType == "Charisma") { story.text = myData.PostCharismaQuestLine[myData.DayCounter]; myData.CharismaEXP += expGained; myData.DailyCharismaEXP[myData.DayCounter] += expGained; } else if (questConstants.questType == "Intelligence") { story.text = myData.PostIntellectQuestLine[myData.DayCounter]; myData.IntellectEXP += expGained; myData.DailyIntellectEXP[myData.DayCounter] += expGained; } myData.DailyTotalEXP[myData.DayCounter] = myData.DailyStrengthEXP[myData.DayCounter] + myData.DailyIntellectEXP[myData.DayCounter] + myData.DailyCharismaEXP[myData.DayCounter]; //Dont go over the max index length //it a temp solution myData.QuestCompleteLog[myData.DayCounter * 100 + myData.DailyQuestCounter] = true; myData.DailyQuestCounter += 1; myData.QuestAmountCompleted += 1; Debug.Log(myData.QuestCompleteLog); DataLogicNew.Save(myData); if (myData.DayCounter == 27) { status.text = "Congradulations! You have completed the game."; } else { status.text = "Quest completed"; } }
void Start() { int expGained = questConstants.timeSpent * 10; DataObject myData = DataLogicNew.Load(); if (myData.DayCounter == 27) { // check for day 28 ie last day story.text = "You have completed the game but you didn't beat the final boss. Start a new character and try again"; } else { if (questConstants.questType == "Strength") { story.text = myData.FailureQuestLine[myData.DayCounter]; myData.StrengthEXP += expGained; myData.DailyStrengthEXP[myData.DayCounter] += expGained; } else if (questConstants.questType == "Charisma") { story.text = myData.FailureQuestLine[myData.DayCounter]; myData.CharismaEXP += expGained; myData.DailyCharismaEXP[myData.DayCounter] += expGained; } else if (questConstants.questType == "Intelligence") { story.text = myData.FailureQuestLine[myData.DayCounter]; myData.IntellectEXP += expGained; myData.DailyIntellectEXP[myData.DayCounter] += expGained; } } myData.DailyTotalEXP[myData.DayCounter] = myData.DailyStrengthEXP[myData.DayCounter] + myData.DailyIntellectEXP[myData.DayCounter] + myData.DailyCharismaEXP[myData.DayCounter]; myData.QuestCompleteLog[myData.DayCounter * 100 + myData.DailyQuestCounter] = false; myData.DailyQuestCounter += 1; DataLogicNew.Save(myData); }