add boss defeat logic
Marco Andronaco andronacomarco@gmail.com
Tue, 14 Apr 2020 18:39:42 +0200
4 files changed,
11 insertions(+),
16 deletions(-)
M
Assets/Scripts/Overworld/Dialogue/Boss.cs
→
Assets/Scripts/Overworld/Dialogue/Boss.cs
@@ -1,18 +1,13 @@
using System.Collections; using System.Collections.Generic; using UnityEngine; +using UnityEngine.SceneManagement; -public class Boss : MonoBehaviour +public class Boss : NPC { - // Start is called before the first frame update - void Start() - { - - } + [SerializeField] private string bossType; - // Update is called once per frame - void Update() - { - + void onDisable(){ + SceneManager.LoadScene(++GameMaster.Instance.currentLevel); } }
M
Assets/Scripts/Utility/GameMaster.cs
→
Assets/Scripts/Utility/GameMaster.cs
@@ -39,7 +39,7 @@ private Vector3 lastPosition;
private Quaternion lastRotation; public bool loaded = false; - private string currentLevel = "Level0"; + public int currentLevel = 0; private string[] partyNames = { "Paladin", "Archer", "Boxer", "Mage" }; private Stats tempStats;@@ -105,7 +105,7 @@ gold += battle.enemyGold;
inventory.addInventory(battle.enemyItems); killedEnemies.Add(fighting); - SceneManager.LoadScene(currentLevel); + SceneManager.LoadScene("Level" + currentLevel); } else //Lost Battle { SceneManager.LoadScene("GameOver");@@ -204,7 +204,7 @@ save.timerfloat = timer;
return save; } - public void LoadManager(string cl, List<string> ke, int g, Dictionary<string, Stats> p,Inventory i, string f, Vector3 pos, Quaternion rot, float timerfloat) + public void LoadManager(int cl, List<string> ke, int g, Dictionary<string, Stats> p,Inventory i, string f, Vector3 pos, Quaternion rot, float timerfloat) { loaded = true; currentLevel = cl;@@ -221,7 +221,7 @@
public void resetGame() { loaded = false; - currentLevel = "Level0"; + currentLevel = 0; killedEnemies = new List<string>(); gold = 0; party = new Dictionary<string, Stats>();
M
Assets/Scripts/Utility/Save.cs
→
Assets/Scripts/Utility/Save.cs
@@ -6,7 +6,7 @@
[System.Serializable] public class Save { - public string currentLevel; + public int currentLevel; public float posx, posy, posz; public float rot0, rot1, rot2, rot3; public List<string> enemiesKilled;
M
Assets/Scripts/Utility/SettingsManager.cs
→
Assets/Scripts/Utility/SettingsManager.cs
@@ -99,7 +99,7 @@ new Dictionary<string, Stats>(save.party), new Inventory(save.inventory),
save.fighting, lastPosition, lastRotation, save.timerfloat); Time.timeScale = 1f; - SceneManager.LoadScene(save.currentLevel); + SceneManager.LoadScene("Level" + save.currentLevel); } else { Debug.Log("No file found.");