Cloned from the Team project repo
This commit is contained in:
15
Assets/Assets_And_Scenes/Scripts/Other Scripts/CoresMeter.cs
Normal file
15
Assets/Assets_And_Scenes/Scripts/Other Scripts/CoresMeter.cs
Normal 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();
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0b3816330663a0944905e7c6c2c19ca2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
41
Assets/Assets_And_Scenes/Scripts/Other Scripts/DeadMenu.cs
Normal file
41
Assets/Assets_And_Scenes/Scripts/Other Scripts/DeadMenu.cs
Normal 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();
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f3de6b36e04a5c3449c7104442440712
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
14
Assets/Assets_And_Scenes/Scripts/Other Scripts/HealthBar.cs
Normal file
14
Assets/Assets_And_Scenes/Scripts/Other Scripts/HealthBar.cs
Normal 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;
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5933daae7cbc4b841bffbf4413124c75
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,88 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class MainMenuScript : 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 SetupVolumeOptions()
|
||||
{
|
||||
// Gets the volume settings from the player profile and sets it in the game
|
||||
float currentMasterVol = PlayerPrefs.GetFloat("currentMasterVol");
|
||||
GameObject masterVolSliderGo = GameObject.Find("Main Slider");
|
||||
|
||||
float currentMusicVol = PlayerPrefs.GetFloat("currentMusicVol");
|
||||
GameObject musicVolSliderGo = GameObject.Find("Music Slider");
|
||||
|
||||
float currentSFXVol = PlayerPrefs.GetFloat("currentSFXVol");
|
||||
GameObject SFXVolSliderGo = GameObject.Find("SFX Slider");
|
||||
|
||||
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();
|
||||
}
|
||||
Application.Quit();
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f532e1e9bceb4b943a33ee226fcec97d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 742ed625e6d4d46439f31a3dd0b6f94c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1a6542ac5327d9d49b523dee5bff0ba0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 39d57a8aa33863c4dbac39c865492676
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
29
Assets/Assets_And_Scenes/Scripts/Other Scripts/RuleMenu.cs
Normal file
29
Assets/Assets_And_Scenes/Scripts/Other Scripts/RuleMenu.cs
Normal 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");
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b5678218a3034524ca1d3eb11b13ae1c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
15
Assets/Assets_And_Scenes/Scripts/Other Scripts/Spedometer.cs
Normal file
15
Assets/Assets_And_Scenes/Scripts/Other Scripts/Spedometer.cs
Normal 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;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 00d71e82bde684141adba79767a86c48
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e7e2c85678107d943bcdd2c894626dba
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user