public void Init(int points) { this.points = points; _pointText.text = points + "dmg"; // show 10 highscores. var highscores = HighscoreManager.GetHighscores(); if (highscores != null) { for (int i = 0; i < highscores.Count; i++) { var highscore = highscores[i]; _highScoreText.text += string.Format("#{0}: {1} \t - {2}dmg\n", i + 1, highscore.Name, highscore.Points); } } // get rank, if its lower than 11, show the form! int rank = HighscoreManager.GetHighscoreRank(new Highscore(null, points), false); if (rank < 11) { _submitForm.SetActive(true); _headerText.text = "You're in!"; } else { _submitForm.SetActive(false); _headerText.text = "Maybe another time!"; } }
public void Setup() { am = MonoBehaviour.Instantiate(TestConstants.GetResource("Managers/Achievement Manager")).GetComponent <AchievementManager>(); gs = MonoBehaviour.Instantiate(TestConstants.GetResource("Managers/Game Settings")).GetComponent <GameSettingsManager>(); hm = MonoBehaviour.Instantiate(TestConstants.GetResource("Managers/Highscore Manager")).GetComponent <HighscoreManager>(); notificationIcon = MonoBehaviour.Instantiate(TestConstants.GetResource("Notification Icon").GetComponent <NotificationIcon>()); }
public void OnRefreshList() { m_HighScoreText.text = "Refreshing..."; m_RefreshListButton.interactable = false; HighscoreManager.DownloadHighscores(m_HighScoreText); StartCoroutine(_RenableRefreshButton()); }
public bool Activate() { if (isActivated) { return(true); } if (!arrowScript.PassTroughAllCheckPoints()) { return(false); } this.time = timerManager.Finish(); this.isActivated = true; this.animator.SetTrigger("startend"); string levelID = Application.loadedLevel.ToString(); float bestTime = HighscoreManager.getHighscoreFloat(levelID); Debug.Log(bestTime + " " + this.time); if (bestTime > this.time) { this.text.text = "You beat the highscore !! press any key to continue."; HighscoreManager.setHighscore(this.time, levelID); } else { this.text.text = "Highscore is still better. press any key to continue."; } return(true); }
private void Start() { player = FindObjectOfType <PlayerController>().GetComponent <Runner>(); highscoreManager = FindObjectOfType <HighscoreManager>(); UpdateHighscoreDisplay(); }
public List <HighScore> getTop(int count = 5) { HighscoreManager hm = new HighscoreManager(); //hm.write ("Andrzej", "Dzisiaj", 100, 3); //hm.write ("Andrzej", "Dzisiaj", 50, 5); List <HighScore> hsc = hm.read(); if (hsc == null) { hsc = new List <HighScore> (); } hsc.Sort(); List <HighScore> highscore = new List <HighScore> (); for (int i = 0; i < count; i++) { try { highscore.Add(hsc[i]); } catch { hsc.Add(new HighScore("", "", 0f, 0)); } } return(highscore); }
/** * -1 = OK * 0 = Mission Complete * +1 = Player was killed * +2 = Time left */ void GameOver() { string eventname = ""; switch (gameOver) { case 0: //Debug.LogWarning("Mision Complete"); eventname = "Mision Complete"; break; case 1: //Debug.LogWarning("Player was killed"); eventname = "Player was killed"; break; case 2: //Debug.LogWarning("Time left"); eventname = "Time left"; break; } if (eventname != "" && !cheatActivated) { HighscoreManager hm = new HighscoreManager(); System.DateTime now = System.DateTime.Now; string timestamp = System.String.Format("{0:0000}-{1:00}-{2:00} {3:00}:{4:00}:{5:00}", now.Year, now.Month, now.Day, now.Hour, now.Minute, now.Second); hm.write("Player1", timestamp, Time.time, level); eventText.guiText.text = eventname; gameOver = -1; } }
public void ShowSubmitScore() { m_HighscoreGUI.SetActive(true); m_SubmitHighscoreGUI.SetActive(true); HighscoreManager.DownloadHighscores(m_HighScoreText); m_RefreshListButton.gameObject.SetActive(false); }
void Awake() { _bloodHeight = BloodSprite.size.y; Blood = InitialBlood; _HSManager = FindObjectOfType <HighscoreManager>(); _highlightColor = HighlightRenderer.material.GetColor("_OutlineColor"); }
// Start is called before the first frame update void Start() { if (PlayerPrefs.HasKey("playerName")) { playerName = PlayerPrefs.GetString("playerName"); } else { playerName = "noname"; } if (PlayerPrefs.HasKey("sensitivity")) { sensitivity = PlayerPrefs.GetFloat("sensitivity"); } else { sensitivity = 1f; } if (PlayerPrefs.HasKey("musicVolume")) { audioMusicLoop.volume = PlayerPrefs.GetFloat("musicVolume"); } else { audioMusicLoop.volume = 0.5f; } highscoreManager = new HighscoreManager(); playerController.deathEvent += OnDeath; playerController.scoreEvent += UpdateScore; //gameState = GameState.Menu; cam = Camera.main.GetComponent <Camera>(); }
void Start() { lives[0] = lives[1] = 3; Score.text = "Score : " + 0; RestartImg.gameObject.SetActive(false); gameManager = GameObject.Find("Game_Manager").GetComponent <GameManager>(); spawnManager = GameObject.Find("SpawnManager").GetComponent <SpawnManager>(); highscoreManager = GameObject.Find("Canvas").GetComponent <HighscoreManager>(); if (gameManager == null) { Debug.LogError("GameManager cannot be attached"); } else if (!gameManager.isCoop) { lives[1] = 0; } if (highscoreManager == null) { Debug.LogError("HighScoreManager cannot be attached"); } if (spawnManager == null) { Debug.LogError("SpawnManager cannot be attached"); } }
// Start is called before the first frame update private void Awake() { if (instance == null) { instance = this; } }
public void Setup() { PlayerPrefs.DeleteAll(); am = MonoBehaviour.Instantiate(TestConstants.GetResource("Managers/Achievement Manager")).GetComponent <AchievementManager>(); gs = MonoBehaviour.Instantiate(TestConstants.GetResource("Managers/Game Settings")).GetComponent <GameSettingsManager>(); hm = MonoBehaviour.Instantiate(TestConstants.GetResource("Managers/Highscore Manager")).GetComponent <HighscoreManager>(); }
private void SubmitHighscore(string name, float time) { HighscoreManager.AddNewTime(name, time); m_SubmitHighscoreGUI.SetActive(false); m_RefreshListButton.gameObject.SetActive(true); ShowHighscore(); }
/// <summary> /// /// </summary> void Update() { if (UmpireControl.isGameStarted && !m_isGameStarted) { for (int i = 0; i < m_bandits.Count; i++) { // show the bandit GameObject bandit = m_bandits[i]; bandit.SetActive(true); // start the bandit's countdown Bandit banditScript = bandit.GetComponent <Bandit>(); banditScript.StartFireCountdown(); } m_isGameStarted = true; } if (m_bandits.Count == 0 && !m_isGameFinished) { UmpireControl umpire = FindObjectOfType <UmpireControl>(); umpire.gameSuccess(); float reactionTime = UmpireControl.reactionTimer; if (HighscoreManager.GetHighscore("Mexican Standoff") > reactionTime) { HighscoreManager.SetHighscore("Mexican Standoff", reactionTime); } umpire.ShowHighscore(HighscoreManager.GetHighscore("Mexican Standoff")); m_isGameFinished = true; } }
public void ShowEndScreen() { Time.timeScale = 0; HighscoreManager.CalculateScore(stopwatch); currentScoreText.text = "Your score is " + HighscoreManager.LastScore; endScreen.SetActive(true); }
// Update is called once per frame void Update() { if (State == GameLogicState.Play) { checkMatch(); _colorPoints = Mathf.Max(_colorPoints - Time.deltaTime * 50, 10); _time -= Time.deltaTime; _timeTransform.anchorMax = new Vector2(_time / _maxTime, _timeTransform.anchorMax.y); if (!_timeCritical && _time / _maxTime <= 0.2) { _timeCritical = true; _timeAnimator.SetBool("critical", true); } if (_timeCritical && _time / _maxTime > 0.2) { _timeCritical = false; _timeAnimator.SetBool("critical", false); } if (_time <= 0.0f) { GameMixer.Instance.ClearColor(); State = GameLogicState.End; _mainText.text = "FIN"; _endCanvas.alpha = 1.0f; _endCanvas.interactable = true; _endCanvas.blocksRaycasts = true; if (string.IsNullOrEmpty(Settings.PlayerName)) { _sendScoreText.text = "please set a player name in the main menu to submit high scores"; } else { _sendScoreText.text = "submitting score..."; StartCoroutine(HighscoreManager.PostScore(Settings.PlayerName, _score, (int)Settings.Mode, Application.isMobilePlatform, () => { _sendScoreText.text = "score sucessfully submitted" + Environment.NewLine + "loading placement..."; StartCoroutine(HighscoreManager.GetPlacement(Settings.PlayerName, (int)Settings.Mode, Application.isMobilePlatform, s => { _sendScoreText.text = "score sucessfully submitted" + Environment.NewLine + s; }, s => { _sendScoreText.text = "score sucessfully submitted" + Environment.NewLine + s; })); }, s => { _sendScoreText.text = s; })); } } } }
private void Start() { Main main = Main.Instance; ManagerStore managerStore = main.ManagerStore; HighscoreManager highscoreManager = managerStore.Get <HighscoreManager>(); highscoreManager.AddListener(this); }
//Returns the instance of the singleton class public static HighscoreManager getHighscoreManager() { if (instance == null) { instance = new HighscoreManager(); } return(instance); }
// Use this for initialization void Start() { player = GameObject.Find("player_ball"); cam = GameObject.Find("Main Camera"); sfx = GameObject.Find("sfxPlayer"); highScoreManager = cam.GetComponent <HighscoreManager>(); }
/// <summary> /// Initialisiert die Highscoreoberfläche /// <param name="graphics">GraphicsDeviceManager</param> /// <param name="highscoreManager">HighscoreManager-Objekt</param> /// </summary> public HighscoreUI(HighscoreManager highscoreManager, GraphicsDeviceManager graphics) { this.font = ViewContent.UIContent.Font; this.background = ViewContent.UIContent.MenuBackgroundImage; this.frame = ViewContent.UIContent.SettingsBackground; this.graphics = graphics; this.highscoreManager = highscoreManager; }
// Use this for initialization void Start() { player = GameObject.Find("player_ball"); cam = GameObject.Find("Main Camera"); sfx = GameObject.Find("sfxPlayer"); highScoreManager = cam.GetComponent<HighscoreManager>(); }
void Awake() { text = GetComponent <Text>(); text.text = "Score: " + ScoreManager.score; HighscoreManager.Set(ScoreManager.score); ErrorManager.errorsCount = 0; ScoreManager.score = 0; }
// Use this for initialization void Start() { animatorShowOptions = GetComponent <Animator>(); loadlvls = GetComponent <LoadAllLevels>(); highScoreMan = this.transform.FindChild("HighScore").GetComponent <HighscoreManager>(); //PlayerPrefs.DeleteAll(); }
private void Awake() { Instance = this; saveDataPath = Application.persistentDataPath + "/solitaireSaveData.ssd"; if (highscoreCanvas.activeSelf) { highscoreCanvas.SetActive(false); } }
private void Start() { player = FindObjectOfType <PlayerController>().GetComponent <Runner>(); enviromentAudioController = FindObjectOfType <EnviromentAudioController>(); highscoreManager = FindObjectOfType <HighscoreManager>(); mainCamera.gameObject.SetActive(false); menuCamera.gameObject.SetActive(true); }
void Start() { highscoreManagerScript = GameObject.Find("Game Manager").GetComponent <HighscoreManager>(); enemySpawnerScript = GameObject.Find("Spawner").GetComponent <EnemySpawner>(); waveText = GameObject.Find("Wave").GetComponent <Text>(); health = 100; life.text = health.ToString(); score = 0; highscore.text = score.ToString(); }
/// <summary> /// Constructs a new DoodleJumpGame instance. /// </summary> public FlappyBirdGame() { Content.RootDirectory = "Content"; graphics = new GraphicsDeviceManager(this); entityManager = new EntityManager(); menuScreen = new MenuScreen(this); playScreen = new PlayScreen(this); highscoreManager = new HighscoreManager(); Console.WriteLine("Created new Flappy Bird Game"); }
public Level(int id) { string levelFilePath = "Levels/level" + id.ToString() + "/"; string[] lines = ((TextAsset)Resources.Load(levelFilePath + "highscore")).text.Split('\n'); image = Resources.Load(levelFilePath + "levelImage", typeof(Texture2D)) as Texture2D; title = lines[0]; HighscoreManager.SetPath(Application.dataPath); highscore = HighscoreManager.getHighscoreString((id + 1).ToString()); }
private void Awake() { if (Instance != null) { Destroy(gameObject); } Instance = this; SceneManager.sceneLoaded += sceneLoaded; DontDestroyOnLoad(gameObject); }
public void LogScore(HighscoreManager highscoreManager) { if (scoreLogged == true) { return; } highscoreManager.AddScore(gameScore, playerName); scoreLogged = true; }
/** * */ void Awake() { mInstance = this; }
/// <summary> /// Initialization after loading /// </summary> void Awake() { mBestScore.Score = 0; InitStats(); mCameraTransf = Camera.main.transform; mCameraHWidth = Camera.main.aspect * Camera.main.orthographicSize; mCameraWidth = mCameraHWidth * 2; mPlayerTransf = gameObject.transform; mHUDController = GameObject.Find("HUD").GetComponent<HUDController>(); mPlayerMarker = mPlayerTransf.Find("Marker").gameObject; mBubbleShield = mPlayerTransf.Find("BubbleShield").gameObject; mAnimator = GetComponent<Animator>(); mRigidBody = GetComponent<Rigidbody2D>(); // Background GameObject bg = GameObject.Find("Background1"); mBGSpriteRenderer1 = bg.GetComponent<SpriteRenderer>(); Vector2 bgSourceSize = mBGSpriteRenderer1.sprite.bounds.size; // BG 1 mBackgroundTransform1 = bg.GetComponent<Transform>(); // BG 2 mBackgroundTransform2 = GameObject.Find("Background2").GetComponent<Transform>(); mBGSpriteRenderer2 = mBackgroundTransform2.GetComponent<SpriteRenderer>(); // BG Scale mBackgroundTransform1.localScale = mBackgroundTransform2.localScale = new Vector3(mCameraWidth / bgSourceSize.x, Camera.main.orthographicSize * 2 / bgSourceSize.y, 1); // BG Position sHelperVector3.Set(mCameraTransf.localPosition.x * FarParallaxFactor, 0, 10); mBackgroundTransform2.localPosition = sHelperVector3; sHelperVector3.x -= mCameraWidth; mBackgroundTransform1.localPosition = sHelperVector3; // Highscores mHighscoreMgr = GameObject.Find("GameData").GetComponent<HighscoreManager>(); mHighscoreMgr.OnScoreListUpdated = OnHighscoreListUpdated; // Update HUD mHUDController.SetCoins(Coins); mHUDController.SetMeters(0); mCameraPosition = mCameraTransf.localPosition; mCameraPosition.x = mPlayerTransf.localPosition.x + CameraXOffset; mCameraTransf.localPosition = mCameraPosition; }
void Awake() { highscoreManager = HighscoreManager.getInstance(); //highscoreManager.LoadFakeData (); }
// Use this for initialization void Start() { GameObject gameControllerObject = GameObject.FindWithTag("GameController"); if (gameControllerObject != null) { gameController = gameControllerObject.GetComponent<GameController>(); uiManager = gameControllerObject.GetComponent<UIManager>(); highscoreManager = gameControllerObject.GetComponent<HighscoreManager>(); } else { Debug.Log("Cannot find 'GameController' script"); } Init(); }
public HighscoreManager getInstance() { if (sInstance == null) { sInstance = new HighscoreManager (); } return sInstance; }