all repos — RPG @ 1be4b62bb8e62efb733d4a69a1b1690c1999981f

Fully functional 3D turn based role playing game coded in C# and base Unity.

add boss defeat logic
Marco Andronaco andronacomarco@gmail.com
Tue, 14 Apr 2020 18:39:42 +0200
commit

1be4b62bb8e62efb733d4a69a1b1690c1999981f

parent

5b0cc0399bcc80945ec61003fc36c07273007cad

M Assets/Scripts/Overworld/Dialogue/Boss.csAssets/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.csAssets/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.csAssets/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.csAssets/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.");