示例#1
0
 public void TogglePause()
 {
     IsPaused = !IsPaused;
     SetInGameMenuActive(IsPaused);
     SetSliderActive(!IsPaused && (GameVariablesScript.ControlScheme == 3));
     BackgroundMusicScript.ToggleBackgroundMusic();
 }
    // Use this for initialization
    void Start()
    {
        IsUsingSlider = false;

        _timer              = 0;
        _cameraIsShifting   = false;
        _shiftEndPosition   = new Vector3(0, 0, -10);
        _shiftStartPosition = new Vector3(0, 0, -10);

        _camera                      = Camera.main;
        _lastScoreText               = GameObject.FindGameObjectWithTag("LastScoreText").GetComponent <Text>();
        _highScoreText               = GameObject.FindGameObjectsWithTag("HighScoreText");
        _sensitivitySlider           = GameObject.FindGameObjectWithTag("SensitivitySlider").GetComponent <Slider>();
        _ballSpeedSlider             = GameObject.FindGameObjectWithTag("BallSpeedSlider").GetComponent <Slider>();
        _controlSchemeToggleButtons  = GameObject.Find("ControlSchemeToggleButtons").transform.GetComponentsInChildren <Transform>();
        _controlSchemeDemoImages     = new GameObject[4];
        _controlSchemeDemoImages[0]  = GameObject.Find("FreeScheme");
        _controlSchemeDemoImages[1]  = GameObject.Find("PreciseScheme");
        _controlSchemeDemoImages[2]  = GameObject.Find("SliderScheme");
        _controlSchemeDemoImages[3]  = GameObject.Find("TapScheme");
        _muteSoundEffectsButtonImage = GameObject.Find("MuteSoundEffectsButton").GetComponent <Image>();
        _muteMusicButtonImage        = GameObject.Find("MuteMusicButton").GetComponent <Image>();
        _socialMenus                 = GameObject.Find("SocialMenus");

        _shiftStartPosition        = new Vector3(GameVariablesScript.ScreenToStartOn * 1080, 0, -10);
        _camera.transform.position = _shiftStartPosition;

        FileServices.LoadGame();

        BackgroundMusicScript.SetBackgroundMusicMute(GameVariablesScript.MusicMuted);

        SetUiFromGameVariables();
    }
    public void ToggleMuteMusic()
    {
        GameVariablesScript.MusicMuted = !GameVariablesScript.MusicMuted;

        _muteMusicButtonImage.overrideSprite = GameVariablesScript.MusicMuted ? MusicOffImage : MusicOnImage;

        BackgroundMusicScript.SetBackgroundMusicMute(GameVariablesScript.MusicMuted);

        FileServices.SaveGame();
    }
示例#4
0
 // Use this for initialization
 void Start()
 {
     if (_instance == null)
     {
         _instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
示例#5
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(gameObject);
     }
     else if (instance != this)
     {
         Destroy(gameObject);
     }
 }
示例#6
0
 private void Awake()
 {
     if (instance != null)
     {
         Destroy(this.gameObject);
     }
     else
     {
         instance = this;
         DontDestroyOnLoad(this.gameObject);
     }
 }
 void Start()
 {
     if (instance)
     {
         DestroyImmediate(gameObject);               // delete duplicate
     }
     else
     {
         instance = this;                    //Make this object the only instance
         DontDestroyOnLoad(gameObject);      // dont destoy it when scenes load
     }
 }
示例#8
0
 void Awake()
 {
     if (instance != null && instance != this)
     {
         Destroy(this.gameObject);
         return;
     }
     else
     {
         instance = this;
     }
     DontDestroyOnLoad(this.gameObject);
 }
    /* Constants */

    void Awake()
    {
        if (Instance != null && Instance != this)
        {
            Destroy(gameObject);
            return;
        }

        Instance = this;
        _backgroundMusicSource      = GetComponent <AudioSource>();
        _backgroundMusicSource.clip = Music;
        _backgroundMusicSource.loop = true;
        _backgroundMusicSource.Play();

        DontDestroyOnLoad(gameObject);
    }
示例#10
0
        public void StopGame()
        {
            GameVariablesScript.LastScore = _actualPointScore;
            if (_actualPointScore > GameVariablesScript.HighScore)
            {
                GameVariablesScript.HighScore = _actualPointScore;
            }

            FileServices.SaveGame();

            // Make the main menu scene load up the score screen first
            GameVariablesScript.ScreenToStartOn = 2;

            BackgroundMusicScript.PlayBackgroundMusic();

            // Disable the ingame menu and enable the start menu
            Application.LoadLevel("MainMenuScene");
        }
 void Awake()
 {
     if (_instance == null)
     {
         //If I am the first instance, make me the Singleton
         _instance = this;
         DontDestroyOnLoad(this);
     }
     else
     {
         //If a Singleton already exists and you find
         //another reference in scene, destroy it!
         if (this != _instance)
         {
             Destroy(this.gameObject);
         }
     }
 }