From 1e04cc6a974079415885ee968b20e4aedb8aae7a Mon Sep 17 00:00:00 2001 From: Lorenzo Balugani Date: Mon, 13 Aug 2018 21:53:54 +0200 Subject: [PATCH] Change in the point calculation alg. --- Assets/Scripts/Countdown.cs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/Assets/Scripts/Countdown.cs b/Assets/Scripts/Countdown.cs index 5e44ca2..ff5fd2f 100644 --- a/Assets/Scripts/Countdown.cs +++ b/Assets/Scripts/Countdown.cs @@ -35,21 +35,16 @@ public class Countdown : MonoBehaviour { ai1 = nave1.GetComponent(); ai2 = nave2.GetComponent(); ai3 = nave3.GetComponent(); - int[] punteggi = { ai1.fishCaught, ai2.fishCaught, ai3.fishCaught}; + int ai = ai1.fishCaught + ai2.fishCaught + ai3.fishCaught; int score = presi.fishCaught; string vincitore = "Player"; - for(int a = 0; a < 3; a++) + if(ai > score) { - if(punteggi[a] > score) - { vincitore = "AI"; - } - } + } Debug.Log(score); Debug.Log(vincitore); - Debug.Log(punteggi[0]); - Debug.Log(punteggi[1]); - Debug.Log(punteggi[2]); + Debug.Log(ai); PlayerPrefs.SetInt("player_score", score); PlayerPrefs.SetString("winner", vincitore); SceneManager.LoadSceneAsync("Results", LoadSceneMode.Single);