
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
154 lines
4.1 KiB
C#
154 lines
4.1 KiB
C#
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;
|
|
|
|
private void Awake()
|
|
{
|
|
GameManager.Instance.currentGameState = GameState.RULESMENU;
|
|
}
|
|
|
|
// 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.LoadSceneAsync("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;
|
|
}
|
|
|
|
}
|
|
}
|