Added multiple game mode selections as well as adding a scene for game mode selection
This commit is contained in:
@@ -80,6 +80,19 @@ public class GMScript : MonoBehaviour
|
||||
void Start()
|
||||
{
|
||||
|
||||
if(PlayerPrefs.GetInt ("GameMode") == 0 ||
|
||||
PlayerPrefs.GetInt ("GameMode") == 2)
|
||||
{
|
||||
isRandom = false;
|
||||
} else {
|
||||
isRandom = true;
|
||||
}
|
||||
|
||||
if(PlayerPrefs.GetInt ("GameMode") == 2)
|
||||
{
|
||||
partyHealth = 1;
|
||||
}
|
||||
|
||||
if(isRandom){
|
||||
|
||||
// GENERATES PARTY MEMBER COLOURS
|
||||
@@ -194,6 +207,11 @@ public class GMScript : MonoBehaviour
|
||||
void Update()
|
||||
{
|
||||
|
||||
if(PlayerPrefs.GetInt ("GameMode") == 3)
|
||||
{
|
||||
partyHealth = 100;
|
||||
}
|
||||
|
||||
noRepeat = true;
|
||||
EnemyHealthText.text = enemyHealth.ToString();
|
||||
PartyHealthText.text = partyHealth.ToString();
|
||||
@@ -256,9 +274,10 @@ public class GMScript : MonoBehaviour
|
||||
|
||||
gameover = true;
|
||||
|
||||
GameOver.SetActive(true);
|
||||
cursorLock = false;
|
||||
|
||||
StartCoroutine(EndGameDisplay(GameOver));
|
||||
|
||||
}
|
||||
|
||||
if(enemyHealth <= 0 || victory == true)
|
||||
@@ -273,9 +292,10 @@ public class GMScript : MonoBehaviour
|
||||
victory = false;
|
||||
gameover = true;
|
||||
|
||||
Victory.SetActive(true);
|
||||
cursorLock = false;
|
||||
|
||||
StartCoroutine(EndGameDisplay(Victory));
|
||||
|
||||
}
|
||||
|
||||
if (Input.GetMouseButtonDown(0))
|
||||
@@ -965,6 +985,19 @@ public class GMScript : MonoBehaviour
|
||||
cursorLock = false;
|
||||
}
|
||||
|
||||
IEnumerator EndGameDisplay(GameObject display)
|
||||
{
|
||||
|
||||
display.SetActive(true);
|
||||
|
||||
yield return new WaitForSeconds(5);
|
||||
|
||||
display.SetActive(false);
|
||||
|
||||
SceneManager.LoadScene("Mode Select Scene");
|
||||
|
||||
}
|
||||
|
||||
void EnemyBuilder()
|
||||
{
|
||||
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class SelectScript : MonoBehaviour
|
||||
{
|
||||
|
||||
private int gameMode;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
gameMode = 1;
|
||||
PlayerPrefs.SetInt("GameMode", gameMode);
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
if (Input.GetMouseButtonDown(0))
|
||||
{
|
||||
|
||||
Vector3 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
|
||||
Vector2 mousePos2D = new Vector2(mousePos.x, mousePos.y);
|
||||
|
||||
RaycastHit2D hit = Physics2D.Raycast(mousePos2D, Vector2.zero);
|
||||
|
||||
if (hit.collider != null) {
|
||||
|
||||
if(hit.collider.gameObject.tag == "Story")
|
||||
{
|
||||
gameMode = 0;
|
||||
PlayerPrefs.SetInt("GameMode", gameMode);
|
||||
SceneManager.LoadScene("Battle Scene");
|
||||
}
|
||||
|
||||
if(hit.collider.gameObject.tag == "Random")
|
||||
{
|
||||
gameMode = 1;
|
||||
PlayerPrefs.SetInt("GameMode", gameMode);
|
||||
SceneManager.LoadScene("Battle Scene");
|
||||
}
|
||||
|
||||
if(hit.collider.gameObject.tag == "Challenge")
|
||||
{
|
||||
gameMode = 2;
|
||||
PlayerPrefs.SetInt("GameMode", gameMode);
|
||||
SceneManager.LoadScene("Battle Scene");
|
||||
}
|
||||
|
||||
if(hit.collider.gameObject.tag == "Training")
|
||||
{
|
||||
gameMode = 3;
|
||||
PlayerPrefs.SetInt("GameMode", gameMode);
|
||||
SceneManager.LoadScene("Battle Scene");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6b74bbe65c700804f90b5101426ed5a8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user