void MakeInstance()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
 // Use this for initialization
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     isAlive    = true;
     score      = 0;
     flapButton = GameObject.FindGameObjectWithTag("FlapButton").GetComponent <Button> ();
     flapButton.onClick.AddListener(() => FlapTheBird());
     SetCameraX();
     spawnerEnemy = GameObject.Find("Enemy Collector");
 }
Esempio n. 3
0
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        isAlive    = true;
        score      = 0;
        flapButton = GameObject.FindGameObjectWithTag("FlapButton").GetComponent <Button>();
        flapButton.onClick.AddListener(() => flapTheBird());

        CameraX();
    }
    void Awake()
    {
        int        selectedBird         = GameController.instance.GetSelectedBird();
        GameObject activeBirdGameObject = birds[selectedBird];

        activeBirdGameObject.SetActive(true);

        activeBird = activeBirdGameObject.GetComponent <BirdScripts>();
        activeBird.RegisterOnEndGameCallBack(DisplayEndGameScoreBoard);
        activeBird.RegisterScoreCallBack(WinAScore);

        flapBtn.onClick.AddListener(Flap);
        menuBtn.onClick.AddListener(GoToMenu);
        replayBtn.onClick.AddListener(Replay);
        pauseBtn.onClick.AddListener(DisplayPauseGameScoreBoard);
        guideBtn.onClick.AddListener(() =>
        {
            guideBtn.gameObject.SetActive(false);
            GameController.instance.ResetGameSpeed();
            activeBird.Resume();
        });
    }