Commit 246d439f by Raphael

Fixed

parents 17e881dd 3671c4b2
No preview for this file type
...@@ -7,8 +7,9 @@ namespace Assets.Scripts ...@@ -7,8 +7,9 @@ namespace Assets.Scripts
{ {
public class GameController : MonoBehaviour public class GameController : MonoBehaviour
{ {
public static int PoolSize = 256; public static int PoolSize = 256;
public static float Speed = 4f; public static float InitialSpeed = 4f;
public static float Speed = InitialSpeed;
public GameObject Wall; public GameObject Wall;
public GameObject BG; public GameObject BG;
...@@ -23,7 +24,9 @@ namespace Assets.Scripts ...@@ -23,7 +24,9 @@ namespace Assets.Scripts
{ {
size = BG.GetComponent<SpriteRenderer>().sprite.bounds.size; size = BG.GetComponent<SpriteRenderer>().sprite.bounds.size;
tra = BG.GetComponent<Transform>(); tra = BG.GetComponent<Transform>();
Screen.orientation = ScreenOrientation.LandscapeLeft; Screen.autorotateToLandscapeRight = true;
Screen.autorotateToLandscapeLeft = true;
Screen.orientation = ScreenOrientation.AutoRotation;
} }
void Update() void Update()
......
...@@ -19,7 +19,10 @@ public class GameOver : MonoBehaviour ...@@ -19,7 +19,10 @@ public class GameOver : MonoBehaviour
public Button buttonPlay; public Button buttonPlay;
void Start() void Start()
{ {
Screen.autorotateToLandscapeRight = true;
Screen.autorotateToLandscapeLeft = true;
Screen.orientation = ScreenOrientation.AutoRotation;
} }
void Update () void Update ()
...@@ -34,6 +37,7 @@ public class GameOver : MonoBehaviour ...@@ -34,6 +37,7 @@ public class GameOver : MonoBehaviour
public void OnButtonPlayClicked() public void OnButtonPlayClicked()
{ {
GameController.Speed = GameController.InitialSpeed;
SceneManager.LoadScene("Main"); SceneManager.LoadScene("Main");
} }
......
...@@ -16,6 +16,9 @@ public class HighScores : MonoBehaviour { ...@@ -16,6 +16,9 @@ public class HighScores : MonoBehaviour {
// Use this for initialization // Use this for initialization
void Start () { void Start () {
Screen.autorotateToLandscapeRight = true;
Screen.autorotateToLandscapeLeft = true;
Screen.orientation = ScreenOrientation.AutoRotation;
ScoreText.text = ""; ScoreText.text = "";
Server = gameObject.GetComponent(typeof(Server)) as Server; Server = gameObject.GetComponent(typeof(Server)) as Server;
} }
......
...@@ -7,7 +7,9 @@ public class Menu : MonoBehaviour { ...@@ -7,7 +7,9 @@ public class Menu : MonoBehaviour {
// Use this for initialization // Use this for initialization
void Start () { void Start () {
Screen.autorotateToLandscapeRight = true;
Screen.autorotateToLandscapeLeft = true;
Screen.orientation = ScreenOrientation.AutoRotation;
} }
// Update is called once per frame // Update is called once per frame
......
...@@ -23,7 +23,7 @@ public class UIController : MonoBehaviour ...@@ -23,7 +23,7 @@ public class UIController : MonoBehaviour
void Start () void Start ()
{ {
_player = GameObject.FindWithTag("Player").GetComponent<Player>(); _player = GameObject.FindWithTag("Player").GetComponent<Player>();
HighScore.enabled = false; HighScore.text = " "; // Keep position of elements, even when not displaying this one
_oldHs = PlayerPrefs.GetInt("highscore"); _oldHs = PlayerPrefs.GetInt("highscore");
} }
...@@ -45,7 +45,7 @@ public class UIController : MonoBehaviour ...@@ -45,7 +45,7 @@ public class UIController : MonoBehaviour
private void HandleScore() private void HandleScore()
{ {
if (_oldHs < _player.Score) if (_oldHs < _player.Score)
HighScore.enabled = true; HighScore.text = "New high score!";
} }
private void HandlePowerUps() private void HandlePowerUps()
...@@ -55,6 +55,5 @@ public class UIController : MonoBehaviour ...@@ -55,6 +55,5 @@ public class UIController : MonoBehaviour
private void DisplayBattery() private void DisplayBattery()
{ {
Battery.sprite = BatteryImages[_player.Battery/8]; Battery.sprite = BatteryImages[_player.Battery/8];
Progression.sprite = ProgressionSprites[_player.Progression / 5];
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment