Implement win/loss states
This commit is contained in:
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class GameManager : MonoBehaviour
|
||||
@@ -65,4 +66,9 @@ public class GameManager : MonoBehaviour
|
||||
m_fadeTotal = 0;
|
||||
m_showFade = true;
|
||||
}
|
||||
|
||||
public void ShowGameResultScene(bool success)
|
||||
{
|
||||
SceneManager.LoadScene(success ? "WinScene" : "LossScene");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ public class QuestManager : MonoBehaviour
|
||||
public int activeQuest = 0;
|
||||
|
||||
public Quest[] quests = {
|
||||
new Quest(_name: "Advert Quest 1", _desc: "Find someone to hand out flyers to advertise our tavern to adventurers. Strength, dexterity, intelligence: doesn<73>t matter, find someone who would do this for as little money as possible.", _failedStr: "Damn, that didn<64>t work at all. That robot just randomly started playing an instrument, much to the dismay of the townspeople.", _successStr: "Perfect, this place will be full of adventurers in no time.", _strength: 0, _intelligence: 0, _charisma: 5),
|
||||
new Quest(_name: "Advert Quest 1", _desc: "Find someone to hand out flyers to advertise our tavern to adventurers. Strength, dexterity, intelligence: doesn<73>t matter, find someone who would do this for as little money as possible.", _failedStr: "Damn, that didn<64>t work at all. That robot just randomly started playing an instrument, much to the dismay of the townspeople.", _successStr: "Perfect, this place will be full of adventurers in no time.", _canRetry: true, _strength: 0, _intelligence: 0, _charisma: 5),
|
||||
};
|
||||
|
||||
private void Awake()
|
||||
@@ -77,6 +77,7 @@ public class QuestManager : MonoBehaviour
|
||||
if (activeQuest >= quests.Length)
|
||||
{
|
||||
Debug.Log("All quests completed");
|
||||
GameManager.Instance.FadePingPong(Win);
|
||||
}
|
||||
|
||||
|
||||
@@ -85,7 +86,23 @@ public class QuestManager : MonoBehaviour
|
||||
|
||||
public void RetryQuest()
|
||||
{
|
||||
GameManager.Instance.FadePingPong();
|
||||
if (quests[activeQuest].canRetry)
|
||||
{
|
||||
GameManager.Instance.FadePingPong();
|
||||
} else
|
||||
{
|
||||
GameManager.Instance.FadePingPong(Loose);
|
||||
}
|
||||
}
|
||||
|
||||
public void Win()
|
||||
{
|
||||
GameManager.Instance.ShowGameResultScene(true);
|
||||
}
|
||||
|
||||
public void Loose()
|
||||
{
|
||||
GameManager.Instance.ShowGameResultScene(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,9 +113,10 @@ public class Quest
|
||||
public string description;
|
||||
public string successStr;
|
||||
public string failedStr;
|
||||
public bool canRetry = false;
|
||||
public int strength, intelligence, charisma;
|
||||
|
||||
public Quest(string _name, string _desc, string _failedStr, string _successStr, int _strength, int _intelligence, int _charisma)
|
||||
public Quest(string _name, string _desc, string _failedStr, string _successStr, bool _canRetry, int _strength, int _intelligence, int _charisma)
|
||||
{
|
||||
this.name = _name;
|
||||
this.description = _desc;
|
||||
@@ -107,6 +125,7 @@ public class Quest
|
||||
this.strength = _strength;
|
||||
this.intelligence = _intelligence;
|
||||
this.charisma = _charisma;
|
||||
this.canRetry = _canRetry;
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user