Quantcast
Channel: Questions in topic: "error message"
Viewing all articles
Browse latest Browse all 2891

Assets/Scripts/GameManager.cs(24,33): error CS0029: Cannot implicitly convert type `bool' to `int'

$
0
0
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; public class GameManager : MonoBehaviour { public int currentScore; public int highScore; public static int currentLevel = 0; public int unlockedLevel; public Color warningColorTimer; public Color defaultColorTimer; public Rect timerRect; public GUISkin skin; public float startTime; private string currentTime; void Start() { //DontDestroyOnLoad(gameObject); if(currentLevel = PlayerPrefs.GetInt("Level Completed") > 0) { PlayerPrefs.GetInt("Level Completed"); } else { currentLevel = 0; } } void Update(){ startTime -= Time.deltaTime; currentTime = string.Format("{0:0.00}", startTime); if(startTime <= 0) { startTime = 0; SceneManager.LoadScene(3); } } public void CompleteLevel() { if(currentLevel < 2) { currentLevel += 1; PlayerPrefs.SetInt("Level Completed", currentLevel); PlayerPrefs.SetInt("Level " + currentLevel.ToString() + " score", currentScore); SceneManager.LoadScene(currentLevel); } else { print("You won"); } } void OnGUI() { GUI.skin = skin; if(startTime < 5f) { skin.GetStyle("Timer").normal.textColor = warningColorTimer; } else { skin.GetStyle("Timer").normal.textColor = defaultColorTimer; } GUI.Label(timerRect, currentTime, skin.GetStyle("Timer")); } }

Viewing all articles
Browse latest Browse all 2891

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>