예제 #1
0
    private void EndGameUI()
    {
        ScoreName.SetActive(true);
        ThisScore.Level = OnLevel;
        ThisScore.Score = AsteroidBehavoir.Score;
        float Highscore = ThisScore.Score;

        if (SaveLoad.scores != null && SaveLoad.scores.Count > 0 && SaveLoad.scores[SaveLoad.scores.Count - 1].Score > Highscore)
        {
            Highscore = SaveLoad.scores[SaveLoad.scores.Count - 1].Score;
        }
        EndUI.GetComponent <Text>().text = "RunScore = " + ThisScore.Score + System.Environment.NewLine + "Asteroids Evaded = " + AsteroidsEvaded
                                           + System.Environment.NewLine + "Highscore = " + Highscore;
    }
예제 #2
0
 void Start()
 {
     ThisScore = new ScoreFormat();
     ScoreName = transform.Find("Canvas/ScoreName").gameObject;
     ScoreName.GetComponent <InputField>().onEndEdit.AddListener(delegate { IsInput(ScoreName.GetComponent <InputField>()); });
     MusicVolSlider.GetComponent <Slider>().value = SaveLoad.musicVol;
     SFXVolSlider.GetComponent <Slider>().value   = SaveLoad.fXVol;
     Tips.SetActive(false);
     PauseScreen.SetActive(false);
     ScoreName.SetActive(false);
     AmmoCount = MaxAmmo;                             //set ammo
     EndUI.GetComponent <Text>().text = string.Empty; //initialised as blank to get rid of the filler text
     ExitGameButton.GetComponent <Button>().onClick.AddListener(ExitGame);
     StartCoroutine(StartAudio());                    //play music
     UpdateBarUI();
 }
예제 #3
0
    internal IEnumerator WaitFor(float WaitTime = 0, string callref = "") //varios timed function calls
    {
        switch (callref)
        {
        case "ResetScene":
            ResettingScene = true;
            do
            {
                yield return(null);
            } while (!isInput);     //wait for player to input his name for the score board
            OnLevel          = 1;
            MaxHP            = 5;
            AsteroidsEvaded  = 0;
            PlayerHealth     = 3;
            LevelTime        = 0;
            MaxRotationSpeed = 450;
            AsteroidBehavoir.PowerUpSpawnRate  = 5;
            AsteroidBehavoir.AsteroidSpawnRate = 3f;
            AsteroidBehavoir.SpawnRateCap      = 1.5f;
            AsteroidBehavoir.Score             = 0;
            AsteroidBehavoir.AsteroidList.Clear();
            GameStarted    = false;
            isInput        = false;
            ResettingScene = false;
            EndUI.GetComponent <Text>().text = string.Empty;
            ScoreName.SetActive(false);
            SceneManager.LoadScene("Play");
            break;

        case ("InvincibilityFrames"):
            InvincibilityFrames = true;
            yield return(new WaitForSeconds(WaitTime));

            InvincibilityFrames = false;
            break;

        case ("BigBullet"):
            BulletMass = 6;
            BulletSize = 3;
            AmmoWait   = 0.15f;
            yield return(new WaitForSeconds(WaitTime));

            BulletMass = 2;
            BulletSize = 1;
            break;

        case ("TripleShot"):
            TripleShot = true;
            AmmoWait   = 0.15f;
            yield return(new WaitForSeconds(WaitTime));

            TripleShot = false;
            AmmoWait   = 0.5f;
            break;

        case ("ShotSpeedUp"):
            ShotSpeed -= 0.1f;
            AmmoWait   = 0;
            yield return(new WaitForSeconds(WaitTime));

            ShotSpeed += 0.1f;
            AmmoWait   = 0.5f;
            break;

        case ("MASSive"):
            BulletMass = 100;
            yield return(new WaitForSeconds(WaitTime));

            BulletMass = 2;
            break;

        default:
            break;
        }
    }