GameJam Progress Day 2
This commit is contained in:
@@ -32,6 +32,9 @@ public class GameManager : MonoBehaviour
|
||||
public Vector3[] initialPositions;
|
||||
public Quaternion[] initialRotations;
|
||||
public GameObject camera;
|
||||
public AudioClip tensionTrack;
|
||||
public AudioClip finalTrack;
|
||||
public AudioClip finishedTrack;
|
||||
|
||||
[Header("Effects")]
|
||||
public int effectStage = 0;
|
||||
@@ -55,6 +58,8 @@ public class GameManager : MonoBehaviour
|
||||
public ColorGrading colorGadingLayer;
|
||||
|
||||
private AudioSource audioSource;
|
||||
private GameSettings settings;
|
||||
private MusicManager musicManager;
|
||||
// Start is called before the first frame update
|
||||
void Awake()
|
||||
{
|
||||
@@ -83,6 +88,25 @@ public class GameManager : MonoBehaviour
|
||||
winLabel.transform.gameObject.SetActive(false);
|
||||
|
||||
this.postProcess.TryGetSettings(out this.colorGadingLayer);
|
||||
|
||||
//apply global settings
|
||||
try
|
||||
{
|
||||
this.settings = GameObject.Find("/settings").GetComponent<GameSettings>();
|
||||
this.musicManager = GameObject.Find("/BackgroundMusic").GetComponent<MusicManager>();
|
||||
|
||||
if (this.settings.playerMode == 1)
|
||||
{
|
||||
this.player2.GetComponent<PlayerController>().aiControlled = true;
|
||||
}
|
||||
}
|
||||
catch (System.Exception)
|
||||
{
|
||||
|
||||
Debug.LogWarning("No settings or music manager object available!");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
@@ -91,7 +115,7 @@ public class GameManager : MonoBehaviour
|
||||
if (this.stageNameCountdown <= this.stageSmall)
|
||||
{
|
||||
this.stageNameT += 4.0f * Time.deltaTime;
|
||||
this.stageName.GetComponent<Text>().fontSize = (int)Mathf.Lerp(155, 100, this.stageNameT);
|
||||
this.stageName.GetComponent<Text>().fontSize = (int)Mathf.Lerp(170, 100, this.stageNameT);
|
||||
}
|
||||
|
||||
if (this.stageNameCountdown <= 0)
|
||||
@@ -203,17 +227,37 @@ public class GameManager : MonoBehaviour
|
||||
winLabel.transform.gameObject.SetActive(true);
|
||||
Time.timeScale = 0.0f;
|
||||
}
|
||||
int currentMaxScore = Mathf.Max(this.scorePlayer1, this.scorePlayer2);
|
||||
|
||||
if (currentMaxScore == 3)
|
||||
{
|
||||
this.musicManager.CrossfadeToTrack(this.tensionTrack, 0.2f);
|
||||
}
|
||||
|
||||
if (currentMaxScore == 4)
|
||||
{
|
||||
this.musicManager.CrossfadeToTrack(this.finalTrack);
|
||||
}
|
||||
|
||||
if (this.scorePlayer2 >= maxGoals || this.scorePlayer1 >= maxGoals)
|
||||
{
|
||||
this.stageName.GetComponent<Text>().text = "Press R to restart";
|
||||
this.stageName.GetComponent<Text>().fontSize = 100;
|
||||
this.musicManager.CrossfadeToTrack(this.finishedTrack, 1.5f);
|
||||
this.stageName.GetComponent<Text>().text = "Press R to restart \n Esc for main menu";
|
||||
this.stageName.GetComponent<Text>().fontSize = 80;
|
||||
if (Input.GetKeyDown(KeyCode.R))
|
||||
{
|
||||
Time.timeScale = 1;
|
||||
SceneManager.LoadScene(SceneManager.GetActiveScene().name);
|
||||
this.colorGadingLayer.temperature.value = 0.0f;
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Escape))
|
||||
{
|
||||
Cursor.visible = true;
|
||||
Time.timeScale = 1;
|
||||
SceneManager.LoadScene("menu");
|
||||
this.colorGadingLayer.temperature.value = 0.0f; //Do this persist on scene unload?
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user