Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            Highscore highscore = Highscore.Instance;

            highscore.Add("Ich", 2147438648);
            highscore.Add("Du", -2147438648);

            highscore.PrintHighscore();


            Highscore highscore2 = Highscore.Instance;

            highscore2.Add("Richi", 2147483647);
            highscore2.PrintHighscore();

            Hexe hexe = new Hexe();

            hexe.Zaubere(new WasserZauber());
            hexe.Zaubere(new FeuerZauber());
            hexe.Zaubere(new WasserZauber());
            hexe.Zaubere(new ErdeZauber());

            Console.ReadKey();
        }
Ejemplo n.º 2
0
        private void continueButton_Click(object sender, EventArgs e)
        {
            if (Highscore.IsNewHighscore(CurrentScore))
            {
                if (String.IsNullOrEmpty(playerNameTextBox.Text))
                {
                    // TODO: Inform user
                    return;
                }

                Highscore.Add(playerNameTextBox.Text, CurrentScore);
            }

            eventManager.Queue(GameStateChangedEvent.To(GameState.Highscore));
        }
Ejemplo n.º 3
0
    public void OpenGameoverMenu()
    {
        gameoverMenu.SetActive(true);
        player.playerStatus = "Died";
        highscore.Add(new HighscoreEntry(player.playerName, dayNightCycle.daysPassed, player.zombiesKilled, player.damageDealt, player.damageTaken, player.playerStatus));
        foreach (var item in ObjectsToDisable)
        {
            item.SetActive(false);
        }

        if (dayNightCycle.daysPassed == 1)
        {
            gameoverText.text = "You died after " + dayNightCycle.daysPassed + " day.";
        }
        else
        {
            gameoverText.text = "You died after " + dayNightCycle.daysPassed + " days.";
        }
    }
Ejemplo n.º 4
0
    IEnumerator StartSequence()
    {
        EnableInput(false);

        float time = 3.9f;

        while (time > 1f)
        {
            time -= Time.deltaTime;
            int number = (int)time;

            if (number > 0)
            {
                BigText.text = "" + number;
                BigText.transform.localScale = Vector3.one * (time % 1f);
            }

            yield return(null);
        }

        BigText.text = "GO!";
        BigText.transform.localScale = Vector3.one;
        EnableInput(true);

        while (time > 0f)
        {
            time -= Time.deltaTime;
            yield return(null);
        }

        BigText.text = "";

        AudioSource tickTockComponent = null;
        int         seconds           = GameLengthSeconds;

        while (seconds > 0 && !endTriggered)
        {
            CountdownText.text = "" + seconds;
            seconds--;

            if (seconds <= 10 && tickTockComponent == null)
            {
                tickTockComponent        = gameObject.AddComponent <AudioSource>();
                tickTockComponent.clip   = tickTockClip;
                tickTockComponent.loop   = true;
                tickTockComponent.volume = .05f;
                tickTockComponent.Play();
            }

            yield return(new WaitForSeconds(1f));
        }

        Destroy(tickTockComponent);
        AudioSource.PlayClipAtPoint(endClip, Vector3.zero);

        EnableInput(false);
        CountdownText.text = "";

        int percent = Mathf.RoundToInt(100f * ScoringSystem.Instance.CalculateScore(TargetLocations, FurnitureLocations));

        StartCoroutine(DrawStars());

        for (float t = 0f; t < 5f; t += Time.deltaTime)
        {
            float perc = t / 5f;
            int   i    = Mathf.RoundToInt(Mathf.Sqrt(perc) * percent - 1);

            BigText.text = "TIME'S UP!\n\nSCORE: " + i + "%";

            yield return(null);
        }

        yield return(new WaitForSeconds(0.5f));

        BigText.text = "TIME'S UP!\n\nSCORE: " + percent + "%";

        yield return(new WaitForSeconds(3f));

        var highscore = new Highscore(levelId);

        if (highscore.ShouldAdd(percent))
        {
            yield return(EnterNameRoutine());

            highscore.Add(new Score {
                Name = "" + ScoreName[0] + ScoreName[1] + ScoreName[2], Percent = percent
            });
        }

        StringBuilder sb = new StringBuilder();

        sb.AppendLine("HIGH SCORES:");
        foreach (var score in highscore.scores)
        {
            sb.AppendLine($"{score.Name} {score.Percent}");
        }
        BigText.text = sb.ToString();

        yield return(new WaitForSeconds(.2f));

        while (true)
        {
            if (Input.anyKey)
            {
                SceneManager.LoadScene("MainMenu");
                yield break;
            }

            yield return(null);
        }
    }
Ejemplo n.º 5
0
 public static void ReqisterHighscore(string name)
 {
     Highscore.Add(new Highscore.HighscoreEntry(name, CurrentScore));
 }
Ejemplo n.º 6
0
 private void HandleShowHighscoreView(string playerName, float score_int)
 {
     Highscore.Add(new PlayerInGameData(playerName, score_int.ToString()));
 }
Ejemplo n.º 7
0
 public void SetHighScore()
 {
     highscore.Add(new HighscoreEntry(player.playerName, dayNightCycle.daysPassed, player.zombiesKilled, player.damageDealt, player.damageTaken, player.playerStatus));
 }
Ejemplo n.º 8
0
    // Reloading level and reseting variables after Mario dies
    public void GameOver()
    {
        if (Mario_script.PositionY < -3 && !audio.isPlaying) // Method starts working only after Game over Audio stops playing
        {
            if (!executed)
            {
                gameOver = true;
                marioScript.Stop(false);
                if (GameTimer == 0)
                {
                    timeUp = true;
                }
                executed  = true;
                GameTimer = GameTimerValue;

                if (!MultiPlayer)
                {
                    if (Mario_script.Lives > 0)
                    {
                        if (currentScene.Contains("Hidden"))
                        {
                            SceneManager.LoadScene(previousScene);
                        }
                        else
                        {
                            SceneManager.LoadScene(currentScene);
                        }
                    }
                    else
                    {
                        setBlackScreen = true;
                        var sss = "Save time: " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString() + "  " + "Pts: " + scoore + " Coins: " + CoinCount.ToString();
                        highscoore.Add(sss);
                    }
                }
                else
                {
                    if ((IsMario && SaveLoad.LuigiLives == 0) || (!IsMario && SaveLoad.MarioLives == 0)) // If second player's lives = 0
                    {
                        if (Mario_script.Lives == 0)                                                     // If current player also doesn't have any lives game will be reloaded
                        {
                            Mario_script.setAnimations = true;
                            Mario_script.luigi         = false;
                            Mario_script.mario         = true;
                            reloadGame     = true;
                            setBlackScreen = true;
                            var sss = "Save time: " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString() + "  " + "Pts: " + scoore + " Coins: " + CoinCount.ToString();
                            highscoore.Add(sss);
                            return;
                        }
                        else
                        {
                            SceneManager.LoadScene(currentScene);
                        }
                    }
                    else
                    {
                        MultiPlayerSwitch(); // Chanigng character
                    }
                }
            }
        }
    }