Browse Source

added game Pause

master
Joshua Reason 9 years ago
parent
commit
88091e3942
7 changed files with 100 additions and 2 deletions
  1. BIN
      playable/Assets/Prefabs/Options.prefab
  2. +4
    -0
      playable/Assets/Prefabs/Options.prefab.meta
  3. BIN
      playable/Assets/Scenes/Level1.unity
  4. BIN
      playable/Assets/Scenes/Level2.unity
  5. +5
    -2
      playable/Assets/Scripts/playerId.cs
  6. +91
    -0
      playable/Assets/sceneController.cs
  7. BIN
      playable/ProjectSettings/InputManager.asset

BIN
playable/Assets/Prefabs/Options.prefab View File


+ 4
- 0
playable/Assets/Prefabs/Options.prefab.meta View File

@ -0,0 +1,4 @@
fileFormatVersion: 2
guid: 7d6b76bf421752e48a6967c631cb08db
NativeFormatImporter:
userData:

BIN
playable/Assets/Scenes/Level1.unity View File


BIN
playable/Assets/Scenes/Level2.unity View File


+ 5
- 2
playable/Assets/Scripts/playerId.cs View File

@ -2,9 +2,11 @@
using System.Collections;
public class playerId : MonoBehaviour {
public bool idVanish = true;
public bool idVanish = false;
public GameObject idTag;
public bool idVanishDisp = true;
// Use this for initialization
void Start () {
@ -16,8 +18,9 @@ public class playerId : MonoBehaviour {
transform.eulerAngles = new Vector3 (transform.eulerAngles.x, 180, transform.eulerAngles.z);
if (Input.GetKeyDown (KeyCode.Backspace)) {
if (Input.GetKeyDown (KeyCode.Backspace) || idVanish != idVanishDisp) {
idVanish = !idVanish;
idVanishDisp = idVanish;
idTag.gameObject.SetActive (idVanish);

+ 91
- 0
playable/Assets/sceneController.cs View File

@ -1,5 +1,6 @@
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class sceneController : MonoBehaviour {
@ -9,11 +10,23 @@ public class sceneController : MonoBehaviour {
public GameObject player4;
public levelController control;
private int playerCount;
public GameObject options;
public bool paused = false;
public GameObject confettiText;
public GameObject scoreText;
public playerId id1;
public playerId id2;
public playerId id3;
public playerId id4;
private playerController playerScript1;
private playerController playerScript2;
private playerController playerScript3;
private playerController playerScript4;
private bool exit = false;
// Use this for initialization
void Awake(){
@ -59,6 +72,84 @@ public class sceneController : MonoBehaviour {
// Update is called once per frame
void Update () {
if (Input.GetButtonDown("start")) {
paused = !paused;
}
optionsSelect ();
}
public void optionsSelect(){
if (paused) {
Time.timeScale = 0.0f;
options.SetActive (true);
} else if (!paused) {
Time.timeScale = 1.0f;
options.SetActive (false);
}
if (exit) {
Time.timeScale = 1.0f;
Application.LoadLevel("Menu_Scene");
}
}
public void confetti(float confettiAmount){
control.confetti = Mathf.RoundToInt(confettiAmount);
confettiText.GetComponent<Text> ().text = "" + Mathf.RoundToInt(confettiAmount);
playerScript1.confettiOnHit = control.confetti;
playerScript2.confettiOnHit = control.confetti;
playerScript3.confettiOnHit = control.confetti;
playerScript4.confettiOnHit = control.confetti;
}
public void sccore (float scoreMax){
control.maxScore = Mathf.RoundToInt(scoreMax);
scoreText.GetComponent<Text> ().text = "" + Mathf.RoundToInt(scoreMax);
playerScript1.maxScore = control.maxScore;
playerScript2.maxScore = control.maxScore;
playerScript3.maxScore = control.maxScore;
playerScript4.maxScore = control.maxScore;
}
public void mute (bool muted){
if (muted)
AudioListener.volume = 0.0f;
else
AudioListener.volume = 1.0f;
}
public void dispID (bool visible){
id1.idVanishDisp = visible;
id2.idVanishDisp = visible;
id3.idVanishDisp = visible;
id4.idVanishDisp = visible;
}
public void exitLevel (){
Time.timeScale = 1.0f;
exit = true;
}
public void resumeGame(){
paused = false;
}
}

BIN
playable/ProjectSettings/InputManager.asset View File


Loading…
Cancel
Save