Ejemplo n.º 1
0
    private IEnumerator LevelState()
    {
        gameOverPanel.DisableGameOverPanel();
        startTextPanel.SetActive(true);
        yield return(WaitForPlayerInitialInput());

        startTextPanel.SetActive(false);
        FindObjectOfType <AudioHandler>().PlayEffect(4);
        while (IsPlayerAlive() && !IsLevelFinished())
        {
            if (!IsGamePaused())
            {
                player.Action();
            }
            yield return(new WaitForFixedUpdate());
        }
        if (!IsPlayerAlive())
        {
            musicHandler.ChangePitch(gameOverPitch);
            StartCoroutine(gameOverPanel.Appear());
        }
        else if (IsLevelFinished())
        {
            SaveAndLoad.FinishAndSaveLevel(collectedCoins == Coin.totalCoin, collectedCoins == 0);
            player.Stop();
            yield return(new WaitForSeconds(player.timeToFinish));

            endLevelPanel.SetActive(true);
        }
        Coin.ResetTotalCoin();
        collectedCoins = 0;
    }
Ejemplo n.º 2
0
    private void Awake()
    {
        if (_instance != null && _instance != this)
        {
            Destroy(this.gameObject);
        }
        else
        {
            _instance = this;
        }
        if (PlayerPrefs.HasKey("LevelId"))
        {
            currentLevel = PlayerPrefs.GetInt("LevelId");
        }
        else
        {
            PlayerPrefs.SetInt("LevelId", currentLevel);
        }
        if (PlayerPrefs.HasKey("HighestScore"))
        {
            bestScore = PlayerPrefs.GetInt("HighestScore");
        }
        else
        {
            PlayerPrefs.SetInt("HighestScore", bestScore);
        }
        if (PlayerPrefs.GetInt("UseMenu").Equals(1) || !PlayerPrefs.HasKey("UseMenu"))
        {
            StartPanel.SetActive(true);
            PlayerPrefs.SetInt("UseMenu", 1);
        }
        else if (PlayerPrefs.GetInt("UseMenu").Equals(0))
        {
            InGamePanel.SetActive(true);
        }

        if (!PlayerPrefs.HasKey("VIBRATION"))
        {
            PlayerPrefs.SetInt("VIBRATION", 1);
            VibrationButton.GetComponent <Image>().sprite = on;
        }
        else
        {
            if (PlayerPrefs.GetInt("VIBRATION") == 1)
            {
                VibrationButton.GetComponent <Image>().sprite = on;
            }
            else
            {
                VibrationButton.GetComponent <Image>().sprite = off;
            }
        }
        if (SoundManager.Instance == null)
        {
            Instantiate(soundManager);
        }
        BestScoreText.text = currentScore.ToString();
        InitializeLevel();
    }
Ejemplo n.º 3
0
 public void Start()
 {
     paused    = false;
     gameEnded = false;
     pausePanel.SetActive(false);
     StartPanel.SetActive(true);
     WinPanel.SetActive(false);
 }
Ejemplo n.º 4
0
 IEnumerator GameStart()
 {
     while (!Input.GetKeyDown(KeyCode.Space) && !Input.GetKeyDown(KeyCode.JoystickButton1))
     {
         yield return(null);
     }
     StartPanel.SetActive(false);
     if (pool.CardCreate())
     {
         StartCoroutine(PointSet());
     }
 }
Ejemplo n.º 5
0
    public void InitNewGame()
    {
        if (StartPanel)
        {
            StartPanel.SetActive(true);
        }

        GameTitle.text  = GameParameters.GameName;
        CurrentLocation = null;

        HideTemplates();
        DeactivateButton(StartButton);

        FillLocations();
    }
Ejemplo n.º 6
0
        private void LoadBeatmapInfo()
        {
            artistText.text  = CurrentBeatmaps[CurrentIndex].Artist;
            authorText.text  = CurrentBeatmaps[CurrentIndex].Author;
            densityText.text = CurrentBeatmaps[CurrentIndex].Density.ToString();
            //Debug.Log(CurrentBeatmaps[CurrentIndex].FilePath);

            animationObj.Play("SelectSong_BeatmapSelected", 0, 0);
            if (!DensityPanel.activeSelf)
            {
                DensityPanel.SetActive(true);
            }
            if (!OptionPanel.activeSelf)
            {
                OptionPanel.SetActive(true);
            }
            if (!StartPanel.activeSelf)
            {
                StartPanel.SetActive(true);
            }
        }
Ejemplo n.º 7
0
 //Начать игру
 public void StartGame()
 {
     StartPanel.SetActive(false);
     GameStarted(currentLocation);
 }
Ejemplo n.º 8
0
 void StartGame()
 {
     StartPanel.SetActive(false);
     Controller.instance.StartGame();
 }
Ejemplo n.º 9
0
 void pause()
 {
     paused = !paused;
     pausePanel.SetActive(paused);
     StartPanel.SetActive(false);
 }