Added Accessors for the GameManager to get the Score, Cores and Level values
Added a Score to the Game Added an actual blackhole material and shader to the black hole Added a new Main menu and How to Play menu system Added Beam swords to all ships (replacing the light saber things the player had) Added a pause menu Overhauled the UI for the game scene Added List to hold the amount of core energy needed for each level Added the URP package for better rendering (apparently) Added a GameState enum to set which part of the game the player is in Added Magnet powerup to game Changed the way powerups are spawned, enemies now have a loot table Changed cores to core energy which is a percentage needed to pass a level Changed all the Ints to Hidden Value ints to maybe stop cheat engine users finding the important values Changed all level loads to use sceneloadasync Updated all of the materials to use URP shaders Removed Junk Files from external sources Rearranged the folders inside the unity project to try and reduce some name length issues
This commit is contained in:
@ -5,7 +5,7 @@ using UnityEngine.Audio;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public enum EnemyType
|
||||
public enum EnemyTypeName
|
||||
{
|
||||
ENEMYDUMB,
|
||||
ENEMYCOWARD,
|
||||
@ -13,6 +13,15 @@ public enum EnemyType
|
||||
ENEMYDROP
|
||||
}
|
||||
|
||||
public enum GameState
|
||||
{
|
||||
MAINMENU,
|
||||
RULESMENU,
|
||||
GAME,
|
||||
DEATHMENU,
|
||||
WINMENU
|
||||
}
|
||||
|
||||
public class GameManager : MonoBehaviour
|
||||
{
|
||||
private static GameManager _instance;
|
||||
@ -25,31 +34,33 @@ public class GameManager : MonoBehaviour
|
||||
}
|
||||
|
||||
// Dictionary to hold the enemy counts and type
|
||||
public Dictionary<EnemyType, Dictionary<int, int>> enemyList = new Dictionary<EnemyType, Dictionary<int, int>>();
|
||||
public Dictionary<EnemyTypeName, EnemyType> enemyList = new Dictionary<EnemyTypeName, EnemyType>();
|
||||
|
||||
public AudioMixer currentAudioMixer;
|
||||
|
||||
public bool godMode = false;
|
||||
|
||||
public int maxLives = 3;
|
||||
public int lives = 3;
|
||||
private HiddenValueInt _startingLives = new HiddenValueInt(5);
|
||||
private HiddenValueInt _lives = new HiddenValueInt(0);
|
||||
|
||||
public bool controller;
|
||||
|
||||
public int firstLevel = 0;
|
||||
public int level = 0;
|
||||
private int _firstLevel = 0;
|
||||
private HiddenValueInt _level = new HiddenValueInt(0);
|
||||
|
||||
public int blackHoleSize = 0;
|
||||
|
||||
public int startCores = 0;
|
||||
private int _coreCount = 0;
|
||||
public int coreNeeded = 5;
|
||||
private int _startCores = 0;
|
||||
private HiddenValueInt _coreCount = new HiddenValueInt(0);
|
||||
private List<HiddenValueInt> _coresNeeded = new List<HiddenValueInt>();
|
||||
|
||||
private HiddenValueInt _score = new HiddenValueInt(0);
|
||||
|
||||
public bool boss = false;
|
||||
public bool isGameOver = false;
|
||||
|
||||
public GameState currentGameState;
|
||||
|
||||
private int _versionMajor = 0;
|
||||
private int _versionMinor = 1;
|
||||
private int _versionMinor = 2;
|
||||
private int _versionRevision = 0;
|
||||
|
||||
public string CurrentVersion
|
||||
@ -60,6 +71,59 @@ public class GameManager : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
public int CurrentLevel
|
||||
{
|
||||
get
|
||||
{
|
||||
return _level.Value;
|
||||
}
|
||||
}
|
||||
|
||||
public int CurrentLives
|
||||
{
|
||||
get
|
||||
{
|
||||
return _lives.Value;
|
||||
}
|
||||
}
|
||||
|
||||
public int CurrentCores
|
||||
{
|
||||
get
|
||||
{
|
||||
return _coreCount.Value;
|
||||
}
|
||||
}
|
||||
|
||||
public int CurrentScore
|
||||
{
|
||||
get
|
||||
{
|
||||
return _score.Value;
|
||||
}
|
||||
}
|
||||
|
||||
public int CurrentNeededCores
|
||||
{
|
||||
get
|
||||
{
|
||||
int result;
|
||||
if (CurrentLevel == -1)
|
||||
{
|
||||
result = -1;
|
||||
}
|
||||
else if (_coresNeeded.Count < CurrentLevel)
|
||||
{
|
||||
result = _coresNeeded[_coresNeeded.Count - 1].Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = _coresNeeded[CurrentLevel].Value;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (_instance != null && _instance != this)
|
||||
@ -105,152 +169,142 @@ public class GameManager : MonoBehaviour
|
||||
|
||||
public void SetupLevel()
|
||||
{
|
||||
lives = maxLives;
|
||||
_coreCount = startCores;
|
||||
level = firstLevel;
|
||||
_lives = _startingLives;
|
||||
_coreCount.Value = _startCores;
|
||||
_level.Value = _firstLevel;
|
||||
_score.Value = 0;
|
||||
isGameOver = false;
|
||||
|
||||
if (_coresNeeded.Count == 0)
|
||||
{
|
||||
_coresNeeded.Add(new HiddenValueInt(4));
|
||||
_coresNeeded.Add(new HiddenValueInt(6));
|
||||
_coresNeeded.Add(new HiddenValueInt(12));
|
||||
_coresNeeded.Add(new HiddenValueInt(16));
|
||||
_coresNeeded.Add(new HiddenValueInt(20));
|
||||
}
|
||||
|
||||
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>();
|
||||
EnemyType enemyDumbSetup = new EnemyType();
|
||||
EnemyType enemyCowardSetup = new EnemyType();
|
||||
EnemyType enemyChaseSetup = new EnemyType();
|
||||
EnemyType enemyDropSetup = new EnemyType();
|
||||
|
||||
// Level 1 numbers
|
||||
enemyDumbSetup.Add(0, 6);
|
||||
enemyCowardSetup.Add(0, 0);
|
||||
enemyChaseSetup.Add(0, 0);
|
||||
enemyDropSetup.Add(0, 0);
|
||||
enemyDumbSetup.AddLevelStats(0, 6, 500, 300.0f, 10.0f);
|
||||
enemyCowardSetup.AddLevelStats(0, 0, 0, 0.0f, 0.0f);
|
||||
enemyChaseSetup.AddLevelStats(0, 0, 0, 0.0f, 0.0f);
|
||||
enemyDropSetup.AddLevelStats(0, 0, 0, 0.0f, 0.0f);
|
||||
|
||||
// Level 2 numbers
|
||||
enemyDumbSetup.Add(1, 8);
|
||||
enemyCowardSetup.Add(1, 2);
|
||||
enemyChaseSetup.Add(1, 0);
|
||||
enemyDropSetup.Add(1, 0);
|
||||
enemyDumbSetup.AddLevelStats(1, 8, 450, 240.0f, 20.0f);
|
||||
enemyCowardSetup.AddLevelStats(1, 2, 1000, 300.0f, 10.0f);
|
||||
enemyChaseSetup.AddLevelStats(1, 0, 0, 0.0f, 0.0f);
|
||||
enemyDropSetup.AddLevelStats(1, 0, 0, 0.0f, 0.0f);
|
||||
|
||||
// Level 3 numbers
|
||||
enemyDumbSetup.Add(2, 8);
|
||||
enemyCowardSetup.Add(2, 3);
|
||||
enemyChaseSetup.Add(2, 1);
|
||||
enemyDropSetup.Add(2, 0);
|
||||
enemyDumbSetup.AddLevelStats(2, 6, 300, 180.0f, 40.0f);
|
||||
enemyCowardSetup.AddLevelStats(2, 3, 800, 240.0f, 20.0f);
|
||||
enemyChaseSetup.AddLevelStats(2, 1, 1500, 360.0f, 5.0f);
|
||||
enemyDropSetup.AddLevelStats(2, 0, 0, 0.0f, 0.0f);
|
||||
|
||||
// Level 4 numbers
|
||||
enemyDumbSetup.Add(3, 10);
|
||||
enemyCowardSetup.Add(3, 3);
|
||||
enemyChaseSetup.Add(3, 2);
|
||||
enemyDropSetup.Add(3, 1);
|
||||
enemyDumbSetup.AddLevelStats(3, 5, 150, 180.0f, 50.0f);
|
||||
enemyCowardSetup.AddLevelStats(3, 4, 500, 240.0f, 30.0f);
|
||||
enemyChaseSetup.AddLevelStats(3, 2, 1000, 300.0f, 20.0f);
|
||||
enemyDropSetup.AddLevelStats(3, 1, 2000, 300.0f, 10.0f);
|
||||
|
||||
// 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);
|
||||
enemyList.Add(EnemyTypeName.ENEMYDUMB, enemyDumbSetup);
|
||||
enemyList.Add(EnemyTypeName.ENEMYCOWARD, enemyCowardSetup);
|
||||
enemyList.Add(EnemyTypeName.ENEMYCHASE, enemyChaseSetup);
|
||||
enemyList.Add(EnemyTypeName.ENEMYDROP, enemyDropSetup);
|
||||
}
|
||||
}
|
||||
|
||||
public int GetCurrentLevelEnemyTypeCount(EnemyType enemyType)
|
||||
public EnemyType.EnemyTypeStat GetCurrentLevelEnemyStats(EnemyTypeName enemyType)
|
||||
{
|
||||
if (enemyList[enemyType][CurrentLevel] == null)
|
||||
{
|
||||
// Get the "last" levels numbers
|
||||
return enemyList[enemyType][enemyList[enemyType].Count - 1];
|
||||
}
|
||||
else
|
||||
{
|
||||
return enemyList[enemyType][CurrentLevel];
|
||||
}
|
||||
}
|
||||
|
||||
public int GetCurrentLevelEnemyTypeCount(EnemyTypeName 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)
|
||||
if (enemyList[enemyType][CurrentLevel] == null)
|
||||
{
|
||||
// Get the "last" levels numbers
|
||||
result = enemyList[enemyType][enemyList[enemyType].Count - 1];
|
||||
result = enemyList[enemyType][enemyList[enemyType].Count - 1].SpawnCount;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get the current levels numbers
|
||||
result = enemyList[enemyType][level];
|
||||
result = enemyList[enemyType][CurrentLevel].SpawnCount;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
void LateUpdate()
|
||||
{
|
||||
if(_coreCount >= coreNeeded)
|
||||
{
|
||||
_coreCount = 0;
|
||||
level++;
|
||||
if (currentGameState == GameState.GAME)
|
||||
{
|
||||
if (CurrentCores >= CurrentNeededCores)
|
||||
{
|
||||
_coreCount.Value = 0;
|
||||
_level += 1;
|
||||
}
|
||||
}
|
||||
BadGuyCount();
|
||||
}
|
||||
|
||||
public void toggleBike()
|
||||
|
||||
public void AddScore(int amount)
|
||||
{
|
||||
if (controller == true)
|
||||
{
|
||||
controller = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
controller = true;
|
||||
}
|
||||
_score += amount;
|
||||
}
|
||||
|
||||
public int getCoreCount()
|
||||
public void WarpLevels(int amount)
|
||||
{
|
||||
return _coreCount;
|
||||
_level += amount;
|
||||
}
|
||||
|
||||
// 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)
|
||||
_lives -= 1;
|
||||
if (CurrentLives <= 0)
|
||||
{
|
||||
DoGameOver();
|
||||
}
|
||||
}
|
||||
|
||||
public int GetLives()
|
||||
public void AddCore(int amount = 1)
|
||||
{
|
||||
return lives;
|
||||
_coreCount += amount;
|
||||
}
|
||||
|
||||
public void AddCore()
|
||||
public void AddLife(int amount = 1)
|
||||
{
|
||||
_coreCount += 1;
|
||||
}
|
||||
|
||||
public void AddLife()
|
||||
{
|
||||
lives += 1;
|
||||
_lives += amount;
|
||||
}
|
||||
public void DoGameOver()
|
||||
{
|
||||
isGameOver = true;
|
||||
SceneManager.LoadScene("Dead");
|
||||
SceneManager.LoadSceneAsync("Dead");
|
||||
}
|
||||
|
||||
public void DoGameWon()
|
||||
{
|
||||
isGameOver = true;
|
||||
SceneManager.LoadScene("Win");
|
||||
SceneManager.LoadSceneAsync("Win");
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +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:
|
||||
fileFormatVersion: 2
|
||||
guid: b0d268dadde08ea448feb22f6fccea32
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences:
|
||||
- currentAudioMixer: {fileID: 24100000, guid: 821047ff923e34549a817a12778763a0, type: 2}
|
||||
executionOrder: -5
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
Reference in New Issue
Block a user