Commit b6ca6734 by Raphael

Added win

parent 28aa4356
No preview for this file type
fileFormatVersion: 2
guid: 7d2eeb02c17ea7447842a1ccbba338a9
timeCreated: 1477408964
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
...@@ -20,5 +20,6 @@ public class Collectible : MonoBehaviour ...@@ -20,5 +20,6 @@ public class Collectible : MonoBehaviour
Destroy(gameObject); Destroy(gameObject);
_player.GetComponent<Player>().Score += 10; _player.GetComponent<Player>().Score += 10;
_player.GetComponent<Player>().Progression += 1; _player.GetComponent<Player>().Progression += 1;
_player.GetComponent<Player>().NbVials += 1;
} }
} }
\ No newline at end of file
...@@ -13,6 +13,7 @@ namespace Assets.Scripts ...@@ -13,6 +13,7 @@ namespace Assets.Scripts
public int Battery = 100; public int Battery = 100;
public int Progression = 0; public int Progression = 0;
public bool IsBlinking = false; public bool IsBlinking = false;
public int NbVials = 0;
void Start() void Start()
{ {
...@@ -30,6 +31,8 @@ namespace Assets.Scripts ...@@ -30,6 +31,8 @@ namespace Assets.Scripts
if (Battery < 12) if (Battery < 12)
SceneManager.LoadScene("GameOver"); SceneManager.LoadScene("GameOver");
if (Progression == 5)
SceneManager.LoadScene("Win");
} }
public void Blink() public void Blink()
......
...@@ -15,6 +15,8 @@ public class UIController : MonoBehaviour ...@@ -15,6 +15,8 @@ public class UIController : MonoBehaviour
public Image Vial2; public Image Vial2;
public Image Vial3; public Image Vial3;
public Image Battery; public Image Battery;
public Image Progression;
public Sprite[] ProgressionSprites;
public List<Sprite> BatteryImages; public List<Sprite> BatteryImages;
private Player _player; private Player _player;
...@@ -34,11 +36,14 @@ public class UIController : MonoBehaviour ...@@ -34,11 +36,14 @@ public class UIController : MonoBehaviour
int score = _player.Score + int.Parse(Distance.text) / 5; int score = _player.Score + int.Parse(Distance.text) / 5;
Score.text = (_player.Score + score).ToString(); Score.text = (_player.Score + score).ToString();
NbVials.text = _player.NbVials.ToString();
DisplayBattery(); DisplayBattery();
} }
private void DisplayBattery() private void DisplayBattery()
{ {
Battery.sprite = BatteryImages[_player.Battery/8]; Battery.sprite = BatteryImages[_player.Battery/8];
Progression.sprite = ProgressionSprites[_player.Progression];
} }
} }
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