Esempio n. 1
0
    private void OnDestroy()
    {
        GamePauser gamePauser = GamePauser.Singleton;

        if (gamePauser != null)
        {
            gamePauser.RemovePauseHelper(this);
        }
    }
Esempio n. 2
0
 private void Awake()
 {
     if (GamePauser.Instance == null)
     {
         GamePauser.Instance = this;
     }
     else if (GamePauser.Instance != null && GamePauser.Instance != this)
     {
         Destroy(this.gameObject);
     }
 }
Esempio n. 3
0
    private void Start()
    {
        Transform canvasTransform = FindObjectOfType <Canvas>().transform;

        pausedPosition = canvasTransform.position;
        Vector3 deltaPos = new Vector3(0, ((RectTransform)canvasTransform).sizeDelta.y, 0);

        deltaPos                += new Vector3(0, ((RectTransform)panel.transform).sizeDelta.y + 300, 0);
        resumedPosition          = canvasTransform.position + deltaPos;
        panel.transform.position = resumedPosition;
        panel.gameObject.SetActive(false);
        gamePauser = FindObjectOfType <GamePauser>();
    }
Esempio n. 4
0
    /////////////////////////////////////////////////////////////////////////////

    //
    //Initializers
    //

    private void Start()
    {
        if (GamePauser.singleton == null)
        {
            singleton = this;
        }
        else
        {
            if (!ReferenceEquals(this, singleton))
            {
                Destroy(gameObject);
            }
        }

        pauseMenu = FindObjectOfType <PauseMenu>();
    }
Esempio n. 5
0
    void Start()
    {
        ReadyToPlay   readyToPlay   = new ReadyToPlay(modeText, leaderboard);
        LevelSelecter levelSelecter = new LevelSelecter(modeText);
        GameRunner    gameRunner    = new GameRunner(blockMover, scoreboardFactory, audioPlayer);
        GamePauser    gamePauser    = new GamePauser(modeText, audioPlayer);
        GameEnder     gameEnder     = new GameEnder(modeText, blockField);
        GameRestarter gameRestarter = new GameRestarter(modeText, leaderboard);

        gameRunner.gravity = gravity;

        readyToPlay.LevelSelecter = levelSelecter;
        levelSelecter.GameRunner  = gameRunner;
        gameRunner.GamePauser     = gamePauser;
        gameRunner.GameEnder      = gameEnder;
        gameEnder.GameRestarter   = gameRestarter;
        gameRestarter.StartScreen = readyToPlay;

        readyToPlay.Show();
        currentMode = readyToPlay;
    }