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,15 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class CoresMeter : MonoBehaviour
{
public Slider CoreMeterBar;
public void Update()
{
CoreMeterBar.value = GameManager.Instance.getCoreCount();
}
}

View File

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

View File

@ -0,0 +1,41 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class DeadMenu : MonoBehaviour
{
// Start is called before the first frame update
public BackgroundMusicManager currentBGMManager;
public MenuAudioManager currentMenuAudioManager;
private void Start()
{
Cursor.lockState = CursorLockMode.None;
// If the BGM manager is present, queue up and play the given track index
if (currentBGMManager)
{
currentBGMManager.StartAudioQueueAndPlay(1);
}
}
public void ReStartGame()
{
// Play the menu click sound if the audio manager is present
if (currentMenuAudioManager)
{
currentMenuAudioManager.PlayMenuClick();
}
SceneManager.LoadScene("Main Menu");
}
public void Quit()
{
// Play the menu click sound if the audio manager is present
if (currentMenuAudioManager)
{
currentMenuAudioManager.PlayMenuClick();
}
Application.Quit();
}
}

View File

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

View File

@ -0,0 +1,14 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class HealthBar : MonoBehaviour
{
public Slider health;
public void Health(int newHealth)
{
health.value = newHealth;
}
}

View File

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

View File

@ -0,0 +1,146 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using UnityEngine.SceneManagement;
public class MainMenuEngine : MonoBehaviour
{
public GameObject hudGO;
public GameObject joystickGO;
public GameObject yolkAGO;
public GameObject yolkBGO;
public TMPro.TextMeshProUGUI versionText;
public BackgroundMusicManager currentBGMManager;
public MenuAudioManager currentMenuAudioManager;
public float joystickJiggleSpeed;
public float flashFrequencyTime;
private TimerHelper _flashTimer;
private MeshRenderer _meshRenderer;
private Color _defaultEmissionColor;
private GameObject _lastControlSelected;
// Start is called before the first frame update
void Start()
{
// If the BGM manager is present, queue up and play the given track index
if (currentBGMManager)
{
currentBGMManager.StartAudioQueueAndPlay(0);
}
_flashTimer = new TimerHelper(flashFrequencyTime);
_meshRenderer = hudGO.GetComponent<MeshRenderer>();
_defaultEmissionColor = _meshRenderer.materials[0].GetColor("_EmissionColor");
versionText.text = versionText.text.Replace("{versionNo}", GameManager.Instance.CurrentVersion);
}
public void SetupVolumeOptions()
{
// Gets the volume settings from the player profile and sets it in the game
float currentMasterVol = PlayerPrefs.GetFloat("currentMasterVol");
GameObject masterVolSliderGo = GameObject.Find("MainVolSlider");
float currentMusicVol = PlayerPrefs.GetFloat("currentMusicVol");
GameObject musicVolSliderGo = GameObject.Find("MusicVolSlider");
float currentSFXVol = PlayerPrefs.GetFloat("currentSFXVol");
GameObject SFXVolSliderGo = GameObject.Find("SfxVolSlider");
masterVolSliderGo.GetComponent<Slider>().value = currentMasterVol;
musicVolSliderGo.GetComponent<Slider>().value = currentMusicVol;
SFXVolSliderGo.GetComponent<Slider>().value = currentSFXVol;
}
public void PlayMenuClick()
{
if (currentMenuAudioManager)
{
currentMenuAudioManager.PlayMenuClick();
}
}
public void StartGame()
{
// Play the menu click sound if the audio manager is present
if (currentMenuAudioManager)
{
currentMenuAudioManager.PlayMenuClick();
}
SceneManager.LoadScene("Rules");
}
public void Quit()
{
// Play the menu click sound if the audio manager is present
if (currentMenuAudioManager)
{
currentMenuAudioManager.PlayMenuClick();
}
#if UNITY_EDITOR
UnityEditor.EditorApplication.isPlaying = false;
#else
Application.Quit();
#endif
}
public void SetMasterVolume(float value)
{
// Converts the master volume into decibels and stores it in the player profile
GameManager.Instance.currentAudioMixer.SetFloat("masterVol", SharedMethods.ConvertToDecibels(value));
PlayerPrefs.SetFloat("currentMasterVol", value);
}
public void SetMusicVolume(float value)
{
// Converts the music volume into decibels and stores it in the player profile
GameManager.Instance.currentAudioMixer.SetFloat("musicVol", SharedMethods.ConvertToDecibels(value));
PlayerPrefs.SetFloat("currentMusicVol", value);
}
public void SetSFXVolume(float value)
{
// Converts the sfx volume into decibels and stores it in the player profile
GameManager.Instance.currentAudioMixer.SetFloat("sfxVol", SharedMethods.ConvertToDecibels(value));
PlayerPrefs.SetFloat("currentSFXVol", value);
}
// Update is called once per frame
void Update()
{
if (_flashTimer.HasTicked(Time.deltaTime))
{
float randomNo = Random.Range(0.0f, 1.0f);
_meshRenderer.materials[0].SetColor("_EmissionColor", Color.Lerp(Color.black, _defaultEmissionColor, randomNo));
}
float horzLRot = -Input.GetAxis("Horizontal") * joystickJiggleSpeed;
float vertLRot = -45.0f + -Input.GetAxis("Vertical") * joystickJiggleSpeed;
joystickGO.transform.eulerAngles = new Vector3(vertLRot, 0.0f, horzLRot);
if (horzLRot != 0)
{
if (EventSystem.current.currentSelectedGameObject == null)
{
EventSystem.current.SetSelectedGameObject(_lastControlSelected);
}
else
{
_lastControlSelected = EventSystem.current.currentSelectedGameObject;
}
}
float horzRRot = -25 + -Input.GetAxis("Mouse X") * joystickJiggleSpeed;
float vertRRot = -25 + -Input.GetAxis("Mouse Y") * joystickJiggleSpeed;
yolkAGO.transform.eulerAngles = new Vector3(vertRRot, 0.0f, 0.0f);
yolkBGO.transform.eulerAngles = new Vector3(horzRRot, 0.0f, 0.0f);
}
}

View File

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

View File

@ -0,0 +1,64 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Audio;
/// <summary>
/// Class to deal with the other collisions for the core
/// </summary>
public class MultiCollider : ColliderManager
{
public AudioClip corePickupSFX;
public GameObject radiusToken;
public GameObject PlayerOne;
public SphereCollider Cores;
private GameObject areaAround;
public int radiusTick;
// Bool checks if the core has been collected, this is because the ships are made of multiple collision boxes and would trigger more than once.
private bool _tokenCollected = false;
public override void ProcessCollision(CollisionDirection direction, Collision collision, bool wasChild)
{
GameObject collisionGO;
if (wasChild)
{
collisionGO = collision.transform.parent.gameObject;
}
else
{
collisionGO = collision.gameObject;
}
// Check the tag of the collided object, Direction doesnt matter i assume
switch (collisionGO.tag)
{
case "Player":
PickupToken();
break;
}
}
/// <summary>
/// Process the core pick up and destroy the core object.
/// </summary>
public void PickupToken()
{
// If the core has been collected ignore it.
if (!_tokenCollected)
{
Debug.Log("Pick up radius");
_tokenCollected = true;
AudioSource.PlayClipAtPoint(corePickupSFX, transform.position);
Destroy(radiusToken);
while (radiusTick > 0)
{
Cores.radius = 10;
radiusTick -= 1;
}
Destroy(areaAround);
}
}
}

View File

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

View File

@ -0,0 +1,28 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ParticalCleanUp : MonoBehaviour
{
// Start is called before the first frame update
private float tik;
private float end = 2;
void Start()
{
tik = 0;
}
// Update is called once per frame
void Update()
{
if(tik >= end)
{
Destroy(gameObject);
}
else
{
tik += Time.deltaTime;
}
}
}

View File

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

View File

@ -0,0 +1,17 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class RestartLevel : MonoBehaviour
{
void Update()
{
if (gameObject.name==("Player")) // need to get this to work when the player dies
{
Scene scene = SceneManager.GetActiveScene();
SceneManager.LoadScene(scene.name);
}
}
}

View File

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

View File

@ -0,0 +1,29 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class RuleMenu : MonoBehaviour
{
public BackgroundMusicManager currentBGMManager;
public MenuAudioManager currentMenuAudioManager;
private void Start()
{
// If the BGM manager is present, queue up and play the given track index
if (currentBGMManager)
{
currentBGMManager.StartAudioQueueAndPlay(0);
}
}
public void StartGame()
{
// Play the menu click sound if the audio manager is present
if (currentMenuAudioManager)
{
currentMenuAudioManager.PlayMenuClick();
}
SceneManager.LoadScene("Game");
}
}

View File

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

View File

@ -0,0 +1,148 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using UnityEngine.SceneManagement;
using UnityEngine.Playables;
public class RulesMenuEngine : MonoBehaviour
{
public GameObject playerCameraGO;
public GameObject playerTrailsGO;
public ParticleSystem starParticles;
public PlayableDirector howToTimeline;
private Vector3 _startPosition;
public GameObject startGameCutscene;
public GameObject startButton;
public GameObject replayButton;
public GameObject skipButton;
public BackgroundMusicManager currentBGMManager;
public MenuAudioManager currentMenuAudioManager;
private bool _cutsceneEnded;
private GameObject _lastControlSelected;
// Start is called before the first frame update
void Start()
{
// If the BGM manager is present, queue up and play the given track index
if (currentBGMManager)
{
currentBGMManager.StartAudioQueueAndPlay(0);
}
_startPosition = playerCameraGO.transform.position;
_cutsceneEnded = false;
}
public void StartGame()
{
// Play the menu click sound if the audio manager is present
if (currentMenuAudioManager)
{
currentMenuAudioManager.PlayMenuClick();
}
startGameCutscene.GetComponent<PlayableDirector>().time = 0;
startGameCutscene.SetActive(true);
}
public void ChangeScene()
{
SceneManager.LoadScene("Game");
}
public void PlayMenuClick()
{
if (currentMenuAudioManager)
{
currentMenuAudioManager.PlayMenuClick();
}
}
public void SlowStarRate()
{
ParticleSystem.MainModule starsMainPS = starParticles.main;
starsMainPS.simulationSpeed = 0.1f;
}
public void NormalStarRate()
{
ParticleSystem.MainModule starsMainPS = starParticles.main;
starsMainPS.simulationSpeed = 1.0f;
CheckIfEndOfTimeline();
}
public void BoostStarRate()
{
ParticleSystem.MainModule starsMainPS = starParticles.main;
starsMainPS.simulationSpeed = 10.0f;
}
public void EscapeStarRate()
{
ParticleSystem.MainModule starsMainPS = starParticles.main;
starsMainPS.maxParticles = 10000;
starsMainPS.simulationSpeed = 100.0f;
starsMainPS.startColor = Color.red;
}
public void DoCutSceneSkip()
{
double fullTime = System.Math.Floor(howToTimeline.time);
int previousSecondMark = (int)fullTime % 10;
howToTimeline.time = (fullTime - previousSecondMark) + 10;
CheckIfEndOfTimeline();
}
public void CheckIfEndOfTimeline()
{
if ((howToTimeline.time + 11) >= howToTimeline.duration)
{
skipButton.SetActive(false);
EventSystem.current.SetSelectedGameObject(startButton);
}
}
public void RestartHowToTimeline()
{
howToTimeline.gameObject.SetActive(true);
skipButton.SetActive(true);
NormalStarRate();
_cutsceneEnded = false;
playerCameraGO.transform.position = _startPosition;
foreach (TrailRenderer currentTrail in playerTrailsGO.GetComponentsInChildren<TrailRenderer>())
{
currentTrail.Clear();
}
howToTimeline.Play();
}
public void EndHowToTimeline()
{
howToTimeline.gameObject.SetActive(false);
skipButton.SetActive(false);
EventSystem.current.SetSelectedGameObject(startButton);
replayButton.SetActive(true);
playerCameraGO.transform.position = _startPosition;
_cutsceneEnded = true;
NormalStarRate();
}
// Update is called once per frame
void Update()
{
if (_cutsceneEnded)
{
//playerTrailsGO.SetActive(true);
playerCameraGO.transform.position = playerCameraGO.transform.forward * 0.05f * Time.deltaTime;
}
}
}

View File

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

View File

@ -0,0 +1,15 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Spedometer : MonoBehaviour
{
public Slider speed;
// Start is called before the first frame update
public void SpeedSlider(float newSpeed)
{
speed.value = newSpeed;
}
}

View File

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

View File

@ -0,0 +1,87 @@
using System;
using System.Collections.Generic;
public enum TimerDirection
{
TimerIncrement,
TimerDecrement
}
public class TimerHelper
{
private float _timerInterval;
private float _timerMax;
private float _timerTick;
private int _timesRun;
private bool _timerRepeats;
private TimerDirection _timerDirection;
public TimerHelper(float timeMax, bool repeating = true, TimerDirection direction = TimerDirection.TimerIncrement)
{
_timerMax = timeMax;
_timerRepeats = repeating;
_timerDirection = direction;
if (_timerDirection == TimerDirection.TimerDecrement)
{
_timerInterval = 0.0f;
_timerTick = -_timerMax;
}
else
{
_timerInterval = _timerMax;
_timerTick = 0.0f;
}
}
public float CurrentTick
{
get
{
return Math.Abs(_timerTick);
}
}
public int TimesRun
{
get
{
return _timesRun;
}
}
public bool HasTicked(float currentTimestamp)
{
if (_timerTick >= _timerInterval)
{
_timesRun++;
if (_timerRepeats)
{
RestartTimer();
}
return true;
}
else
{
_timerTick += currentTimestamp;
return false;
}
}
public void RestartTimer()
{
if (_timerDirection == TimerDirection.TimerDecrement)
{
_timerTick = -_timerMax;
}
else
{
_timerTick = 0.0f;
}
}
}

View File

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

View File

@ -0,0 +1,68 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Audio;
/// <summary>
/// Class to deal with the other collisions for the core
/// </summary>
public class laserCollider : ColliderManager
{
public AudioClip corePickupSFX;
public GameObject laserToken;
public int laserTick;
public GameObject LaserStick1;
public GameObject LaserStick2;
// Bool checks if the core has been collected, this is because the ships are made of multiple collision boxes and would trigger more than once.
private bool _tokenCollected = false;
public override void ProcessCollision(CollisionDirection direction, Collision collision, bool wasChild)
{
GameObject collisionGO;
if (wasChild)
{
collisionGO = collision.transform.parent.gameObject;
}
else
{
collisionGO = collision.gameObject;
}
// Check the tag of the collided object, Direction doesnt matter i assume
switch (collisionGO.tag)
{
case "Player":
PickupToken();
break;
}
}
/// <summary>
/// Process the core pick up and destroy the core object.
/// </summary>
public void PickupToken()
{
// If the core has been collected ignore it.
if (!_tokenCollected)
{
Debug.Log("Pick up laser");
_tokenCollected = true;
AudioSource.PlayClipAtPoint(corePickupSFX, transform.position);
Destroy(laserToken);
while (laserTick != 0)
{
LaserStick1.transform.localScale = new Vector3(0.07000001f, 1.2f, 0.07000001f);
LaserStick1.transform.position = new Vector3(LaserStick1.transform.position.x - 5.27541f,
LaserStick1.transform.position.y - 1.240699f, LaserStick1.transform.position.z + 3.87f);
LaserStick2.transform.localScale = new Vector3(0.07000001f, 1.2f, 0.07000001f);
LaserStick2.transform.position = new Vector3(LaserStick2.transform.position.x - 0.2f,
LaserStick2.transform.position.y - 1.3f, LaserStick2.transform.position.z + 3.62f);
laserTick -= 1;
}
}
}
}

View File

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