Added Main menu Changes to UI

Added Rules Menu Changes to UI
Added Cutscenes to the rules scene
Reorganised Files
This commit is contained in:
iDunnoDev
2022-06-22 13:30:58 +01:00
committed by iDunnoDev
parent e30ffcfc80
commit 0360907df1
1276 changed files with 55430 additions and 32901 deletions

View File

@ -0,0 +1,256 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Audio;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public enum EnemyType
{
ENEMYDUMB,
ENEMYCOWARD,
ENEMYCHASE,
ENEMYDROP
}
public class GameManager : MonoBehaviour
{
private static GameManager _instance;
public static GameManager Instance
{
get
{
return _instance;
}
}
// Dictionary to hold the enemy counts and type
public Dictionary<EnemyType, Dictionary<int, int>> enemyList = new Dictionary<EnemyType, Dictionary<int, int>>();
public AudioMixer currentAudioMixer;
public bool godMode = false;
public int maxLives = 3;
public int lives = 3;
public bool controller;
public int firstLevel = 0;
public int level = 0;
public int blackHoleSize = 0;
public int startCores = 0;
private int _coreCount = 0;
public int coreNeeded = 5;
public bool boss = false;
public bool isGameOver = false;
private int _versionMajor = 0;
private int _versionMinor = 1;
private int _versionRevision = 0;
public string CurrentVersion
{
get
{
return _versionMajor.ToString() + "." + _versionMinor.ToString() + "." + _versionRevision.ToString();
}
}
private void Awake()
{
if (_instance != null && _instance != this)
{
Destroy(gameObject);
}
else
{
_instance = this;
DontDestroyOnLoad(gameObject);
}
}
private void Start()
{
// Load the saved audio levels into the mixer
if (PlayerPrefs.HasKey("currentMasterVol"))
{
float currentMasterVol = PlayerPrefs.GetFloat("currentMasterVol");
float currentMusicVol = PlayerPrefs.GetFloat("currentMusicVol");
float currentSFXVol = PlayerPrefs.GetFloat("currentSFXVol");
currentAudioMixer.SetFloat("masterVol", SharedMethods.ConvertToDecibels(currentMasterVol));
currentAudioMixer.SetFloat("musicVol", SharedMethods.ConvertToDecibels(currentMusicVol));
currentAudioMixer.SetFloat("sfxVol", SharedMethods.ConvertToDecibels(currentSFXVol));
}
else
{
float currentMasterVol = 1.0f;
float currentMusicVol = 0.5f;
float currentSFXVol = 0.8f;
currentAudioMixer.SetFloat("masterVol", SharedMethods.ConvertToDecibels(currentMasterVol));
currentAudioMixer.SetFloat("musicVol", SharedMethods.ConvertToDecibels(currentMusicVol));
currentAudioMixer.SetFloat("sfxVol", SharedMethods.ConvertToDecibels(currentSFXVol));
PlayerPrefs.SetFloat("currentMasterVol", currentMasterVol);
PlayerPrefs.SetFloat("currentMusicVol", currentMusicVol);
PlayerPrefs.SetFloat("currentSFXVol", currentSFXVol);
}
}
public void SetupLevel()
{
lives = maxLives;
_coreCount = startCores;
level = firstLevel;
isGameOver = false;
if (enemyList.Count == 0)
{
// Set up the enemy level and count dictionaries
Dictionary<int, int> enemyDumbSetup = new Dictionary<int, int>();
Dictionary<int, int> enemyCowardSetup = new Dictionary<int, int>();
Dictionary<int, int> enemyChaseSetup = new Dictionary<int, int>();
Dictionary<int, int> enemyDropSetup = new Dictionary<int, int>();
// Level 1 numbers
enemyDumbSetup.Add(0, 6);
enemyCowardSetup.Add(0, 0);
enemyChaseSetup.Add(0, 0);
enemyDropSetup.Add(0, 0);
// Level 2 numbers
enemyDumbSetup.Add(1, 8);
enemyCowardSetup.Add(1, 2);
enemyChaseSetup.Add(1, 0);
enemyDropSetup.Add(1, 0);
// Level 3 numbers
enemyDumbSetup.Add(2, 8);
enemyCowardSetup.Add(2, 3);
enemyChaseSetup.Add(2, 1);
enemyDropSetup.Add(2, 0);
// Level 4 numbers
enemyDumbSetup.Add(3, 10);
enemyCowardSetup.Add(3, 3);
enemyChaseSetup.Add(3, 2);
enemyDropSetup.Add(3, 1);
// Add the counts to the enemy type dictionaries
enemyList.Add(EnemyType.ENEMYDUMB, enemyDumbSetup);
enemyList.Add(EnemyType.ENEMYCOWARD, enemyCowardSetup);
enemyList.Add(EnemyType.ENEMYCHASE, enemyChaseSetup);
enemyList.Add(EnemyType.ENEMYDROP, enemyDropSetup);
}
}
public int GetCurrentLevelEnemyTypeCount(EnemyType enemyType)
{
int result;
// Check if the current level is higher than the max we have set up (we should probs cap it)
if (level > enemyList[enemyType].Count - 1)
{
// Get the "last" levels numbers
result = enemyList[enemyType][enemyList[enemyType].Count - 1];
}
else
{
// Get the current levels numbers
result = enemyList[enemyType][level];
}
return result;
}
// Update is called once per frame
void Update()
{
if(_coreCount >= coreNeeded)
{
_coreCount = 0;
level++;
}
BadGuyCount();
}
public void toggleBike()
{
if (controller == true)
{
controller = false;
}
else
{
controller = true;
}
}
public int getCoreCount()
{
return _coreCount;
}
// This is dealt with in the enemy dictionary
private void BadGuyCount()
{
switch (level)
{
case 0:
break;
case 1:
break;
case 2:
break;
case 3:
break;
case 4:
//Temp until boss added, then add new case 5: with DoGameWon(); and uncomment boss = true;
if (!isGameOver)
{
DoGameWon();
}
//boss = true;
break;
}
}
public void LostLife()
{
lives -= 1;
if (lives <= 0)
{
DoGameOver();
}
}
public int GetLives()
{
return lives;
}
public void AddCore()
{
_coreCount += 1;
}
public void AddLife()
{
lives += 1;
}
public void DoGameOver()
{
isGameOver = true;
SceneManager.LoadScene("Dead");
}
public void DoGameWon()
{
isGameOver = true;
SceneManager.LoadScene("Win");
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: b0d268dadde08ea448feb22f6fccea32
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences:
- currentAudioMixer: {fileID: 24100000, guid: 821047ff923e34549a817a12778763a0, type: 2}
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,59 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &8414549911128429761
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8414549911128429766}
- component: {fileID: 2428516214987490070}
m_Layer: 0
m_Name: GameManagerObject
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &8414549911128429766
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8414549911128429761}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &2428516214987490070
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8414549911128429761}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b0d268dadde08ea448feb22f6fccea32, type: 3}
m_Name:
m_EditorClassIdentifier:
currentAudioMixer: {fileID: 24100000, guid: 821047ff923e34549a817a12778763a0, type: 2}
godMode: 0
maxLives: 3
lives: 3
spaceRocks: 10
badGuys: 5
controller: 0
firstLevel: 0
level: 0
blackHoleSize: 0
startCores: 0
coreNeeded: 5
boss: 0
isGameOver: 0

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: d8ca7d7cf1a5dc04f880b2716664368e
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: