Added multiple game mode selections as well as adding a scene for game mode selection

This commit is contained in:
Gregory Campbell
2020-05-02 19:02:04 -04:00
parent 6882c368ef
commit af458d9529
17 changed files with 1267 additions and 10 deletions
+66
View File
@@ -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");
}
}
}
}
}