Updated Unity Version

Added graphics options and rendering quality level settings
Added new movement patterns to the dumb enemy AI
Added chance for Coward Enemies to drop a random
Added method to correctly reset the game variables on death and win screens
Updated the UI to work on different resolutions without breaking
Moved Sprites into a sprites folder
Fixed issue where score would overflow the int because the multiplier was too high
Fixed issue where new lives gained from the score breakpoints were not being calculated correctly
Fixed issue where clicking off a menu element then trying to control the menu with the controller did not correctly reselect a menu item
Fixed issue where enemies colliding with the outer boundary too much would break the sfx and music (i assume from a buffering issue)
This commit is contained in:
iDunnoDev
2022-07-23 14:43:52 +01:00
committed by iDunnoDev
parent fb3415c7b2
commit 62254a0332
145 changed files with 26991 additions and 1397 deletions

View File

@ -42,7 +42,7 @@ public class DeadEngine : MonoBehaviour
_defaultEmissionColor = _meshRenderer.materials[0].GetColor("_EmissionColor");
_lastControlSelected = EventSystem.current.firstSelectedGameObject;
scoreText.text = scoreText.text.Replace("{SCORE}", GameManager.Instance.CurrentScore.ToString().PadLeft(10, '0'));
scoreText.text = scoreText.text.Replace("{SCORE}", GameManager.Instance.CurrentScore.ToString().PadLeft(9, '0'));
}
public void PlayMenuClick()
@ -70,6 +70,7 @@ public class DeadEngine : MonoBehaviour
{
currentMenuAudioManager.PlayMenuClick();
}
GameManager.Instance.ResetStats();
SceneManager.LoadSceneAsync("Game");
}

View File

@ -0,0 +1,73 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
[RequireComponent(typeof(ScrollRect))]
public class DropDownScrollbarHelper : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
{
RectTransform scrollRectTransform;
RectTransform contentPanel;
RectTransform selectedRectTransform;
GameObject lastSelected;
Vector2 targetPos;
void Start()
{
scrollRectTransform = GetComponent<RectTransform>();
if (contentPanel == null)
contentPanel = GetComponent<ScrollRect>().content;
targetPos = contentPanel.anchoredPosition;
}
void Update()
{
if (!_mouseHover)
Autoscroll();
}
public void Autoscroll()
{
if (contentPanel == null)
contentPanel = GetComponent<ScrollRect>().content;
GameObject selected = EventSystem.current.currentSelectedGameObject;
if (selected == null)
{
return;
}
if (selected.transform.parent != contentPanel.transform)
{
return;
}
if (selected == lastSelected)
{
return;
}
selectedRectTransform = (RectTransform)selected.transform;
targetPos.x = contentPanel.anchoredPosition.x;
targetPos.y = -(selectedRectTransform.localPosition.y) - (selectedRectTransform.rect.height / 2);
targetPos.y = Mathf.Clamp(targetPos.y, 0, contentPanel.sizeDelta.y - scrollRectTransform.sizeDelta.y);
contentPanel.anchoredPosition = targetPos;
lastSelected = selected;
}
bool _mouseHover;
public void OnPointerEnter(PointerEventData eventData)
{
_mouseHover = true;
}
public void OnPointerExit(PointerEventData eventData)
{
_mouseHover = false;
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 99396d0b10d909c48a842775cb13ae0d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -116,6 +116,7 @@ public class GameEngine : MonoBehaviour
_playerJumped = false;
_playerJumpFlash = new TimerHelper(0.5f);
_winCinematicDone = false;
_lastControlSelected = EventSystem.current.firstSelectedGameObject;
for (int i = 0; i < dialogGOList.Count; i++)
{
@ -206,12 +207,12 @@ public class GameEngine : MonoBehaviour
{
if (scoreText != null)
{
scoreText.GetComponent<TMPro.TextMeshProUGUI>().text = GameManager.Instance.CurrentScore.ToString().PadLeft(10, '0');
scoreText.GetComponent<TMPro.TextMeshProUGUI>().text = GameManager.Instance.CurrentScore.ToString().PadLeft(9, '0');
}
int newLifeCheck = Mathf.FloorToInt(GameManager.Instance.CurrentScore / _scorePerLifeUp.Value);
if (_lastScoreCheck.Value < newLifeCheck && !_gameOverHit)
{
GameManager.Instance.AddLife(_lastScoreCheck.Value - newLifeCheck);
GameManager.Instance.AddLife(newLifeCheck - _lastScoreCheck.Value);
_lastScoreCheck.Value = newLifeCheck;
if (lifeUpSFX != null)
{
@ -423,17 +424,15 @@ public class GameEngine : MonoBehaviour
if (isPaused)
{
float horzLRot = Input.GetAxis("Horizontal") + Input.GetAxis("Vertical");
if (horzLRot != 0)
float horzIn = Input.GetAxisRaw("Horizontal");
float vertIn = Input.GetAxisRaw("Vertical");
if (horzIn != 0 || vertIn != 0)
{
if (EventSystem.current.currentSelectedGameObject == null)
{
EventSystem.current.SetSelectedGameObject(_lastControlSelected);
}
else
{
_lastControlSelected = EventSystem.current.currentSelectedGameObject;
}
EventSystem.current.SetSelectedGameObject(pauseMenuFirstItem);
}
}
}
@ -500,10 +499,11 @@ public class GameEngine : MonoBehaviour
public void CalcFinalScore(bool wonGame)
{
int workingScore = GameManager.Instance.CurrentScore;
workingScore += 100000 * GameManager.Instance.CurrentLevel;
workingScore += 10000 * GameManager.Instance.CurrentLevel;
if (wonGame)
{
workingScore *= Mathf.FloorToInt(_bonusTimeLimit.Position * 10.0f);
workingScore += 1000 * GameManager.Instance.CurrentLives;
workingScore += 5000 * Mathf.FloorToInt(_bonusTimeLimit.Position * 100.0f);
}
GameManager.Instance.SetScore(workingScore);
}

View File

@ -4,6 +4,7 @@ using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using UnityEngine.SceneManagement;
using UnityEngine.Rendering;
public class MainMenuEngine : MonoBehaviour
{
@ -13,6 +14,11 @@ public class MainMenuEngine : MonoBehaviour
public GameObject yolkBGO;
public TMPro.TextMeshProUGUI versionText;
public TMPro.TMP_Dropdown qualityDropdown;
public TMPro.TMP_Dropdown resolutionDropdown;
public TMPro.TMP_Dropdown fullscreenDropdown;
public List<RenderPipelineAsset> renderPipelines = new List<RenderPipelineAsset>();
public BackgroundMusicManager currentBGMManager;
public MenuAudioManager currentMenuAudioManager;
@ -63,6 +69,126 @@ public class MainMenuEngine : MonoBehaviour
masterVolSliderGo.GetComponent<Slider>().value = currentMasterVol;
musicVolSliderGo.GetComponent<Slider>().value = currentMusicVol;
SFXVolSliderGo.GetComponent<Slider>().value = currentSFXVol;
qualityDropdown.value = QualitySettings.GetQualityLevel();
int selectedResolution = 0;
string resolutionString = Screen.width.ToString() + " X " + Screen.height.ToString();
switch(resolutionString)
{
case "1280 X 720":
selectedResolution = 1;
break;
case "1280 X 800":
selectedResolution = 2;
break;
case "1366 X 768":
selectedResolution = 3;
break;
case "1440 X 900":
selectedResolution = 4;
break;
case "1680 X 1050":
selectedResolution = 5;
break;
case "1920 X 1080":
selectedResolution = 6;
break;
case "2560 X 1440":
selectedResolution = 7;
break;
case "3840 X 2160":
selectedResolution = 8;
break;
default:
selectedResolution = 0;
break;
}
resolutionDropdown.value = selectedResolution;
int fullscreenModeId = 0;
switch (Screen.fullScreenMode)
{
case FullScreenMode.ExclusiveFullScreen:
fullscreenModeId = 0;
break;
case FullScreenMode.Windowed:
fullscreenModeId = 2;
break;
default:
case FullScreenMode.FullScreenWindow:
fullscreenModeId = 1;
break;
}
fullscreenDropdown.value = fullscreenModeId;
}
public void SaveOptionChanges()
{
QualitySettings.SetQualityLevel(qualityDropdown.value);
QualitySettings.renderPipeline = renderPipelines[qualityDropdown.value];
int resolutionWidth = Screen.width;
int resolutionHeight = Screen.height;
switch(resolutionDropdown.value)
{
case 1:
resolutionWidth = 1280;
resolutionHeight = 720;
break;
case 2:
resolutionWidth = 1280;
resolutionHeight = 800;
break;
case 3:
resolutionWidth = 1366;
resolutionHeight = 768;
break;
case 4:
resolutionWidth = 1440;
resolutionHeight = 900;
break;
case 5:
resolutionWidth = 1680;
resolutionHeight = 1050;
break;
case 6:
resolutionWidth = 1920;
resolutionHeight = 1080;
break;
case 7:
resolutionWidth = 2560;
resolutionHeight = 1440;
break;
case 8:
resolutionWidth = 3840;
resolutionHeight = 2160;
break;
default:
case 0:
break;
}
FullScreenMode newFullScreenMode = Screen.fullScreenMode;
switch(fullscreenDropdown.value)
{
case 0:
newFullScreenMode = FullScreenMode.ExclusiveFullScreen;
break;
case 2:
newFullScreenMode = FullScreenMode.Windowed;
break;
default:
case 1:
newFullScreenMode = FullScreenMode.FullScreenWindow;
break;
}
Screen.SetResolution(resolutionWidth, resolutionHeight, newFullScreenMode);
}
public void PlayMenuClick()

View File

@ -58,6 +58,7 @@ public class RulesMenuEngine : MonoBehaviour
public void ChangeScene()
{
GameManager.Instance.ResetStats();
SceneManager.LoadSceneAsync("Game");
}

View File

@ -30,7 +30,7 @@ public class WinEngine : MonoBehaviour
currentBGMManager.StartAudioQueueAndPlay(0);
}
scoreText.text = scoreText.text.Replace("{SCORE}", GameManager.Instance.CurrentScore.ToString().PadLeft(10, '0'));
scoreText.text = scoreText.text.Replace("{SCORE}", GameManager.Instance.CurrentScore.ToString().PadLeft(9, '0'));
_lastControlSelected = EventSystem.current.firstSelectedGameObject;
}
@ -59,6 +59,7 @@ public class WinEngine : MonoBehaviour
{
currentMenuAudioManager.PlayMenuClick();
}
GameManager.Instance.ResetStats();
SceneManager.LoadSceneAsync("Game");
}