private void Update()
    {
        walk      = Input.GetAxisRaw("Horizontal") * walkSpeed;
        jumpStart = Input.GetButtonDown("Jump");
        jump      = Input.GetButton("Jump");

        CheckGround();

        if (_rigidbody.velocity.magnitude >= 0.1f)
        {
            transform.GetChild(0).GetComponent <Animator>().SetBool("isWalking", true);
            //transform.GetChild(1).GetComponent<Animator>().SetBool("isWalking", true);
        }
        else
        {
            transform.GetChild(0).GetComponent <Animator>().SetBool("isWalking", false);
            //transform.GetChild(1).GetComponent<Animator>().SetBool("isWalking", false);
        }

        if (!isSwinging && !platformRotating && !goalReached)
        {
            Walk();
            Jump();

            if ((walk > 0.0f && !facingRight) || (walk < 0.0f && facingRight) && !PauseUI.GetGameIsPaused())
            {
                Flip();
            }
        }

        if (EndOfLevel.goalReached == true)
        {
            OnReachGoal();
        }
    }
Example #2
0
    // Use this for initialization
    void Start()
    {
        if (GameInstance.CurrentLevel != null && GameInstance.CurrentLevel.isCustom)
        {
            LoadCustomLevel();
        }

        Instance       = this;
        Time.timeScale = 1;
        winMenu.gameObject.SetActive(false);



        Spawnpoint = initialSpawnPoint;
        if (Spawnpoint == null)
        {
            Spawnpoint = GameObject.Find("InitSpawnPoint").GetComponent <CheckPoint>();
        }

        Spawnpoint.TurnOn();
        SpawnNewPlayer();
        centerText.text = "";
        paused          = false;
        PauseUI.SetActive(false);
        StartTime = Time.time;
    }
Example #3
0
    private void OnMenuButtonClick()
    {
        GameDetailsUI.SetActive(false);
        scorePauseText.text = "SCORE: " + score.ToString();

        if (currentLevel == Levels.maxLevels)
        {
            highScorePauseText.text = "HIGH SCORE: " + highScore.ToString();
        }
        else
        {
            highScorePauseText.text = "MAX SCORE: " + highScore.ToString();
        }

        if (Bird.gameStatus == Bird.GameStatus.DEAD)
        {
            gameOverText.text   = "OOPS! BIRD DIED";
            tapToStartText.text = "FLAP TO RESTART";
        }
        else if (Bird.gameStatus == Bird.GameStatus.PAUSED)
        {
            gameOverText.text   = "GAME PAUSED";
            tapToStartText.text = "TAP TO CONTINUE";
        }
        else
        {
            gameOverText.color  = new Color32(0, 204, 0, 255);
            gameOverText.text   = "LEVEL COMPLETED";
            tapToStartText.text = "TAP TO CONTINUE";
        }

        PauseUI.SetActive(true);
        Time.timeScale = 0f;
    }
Example #4
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Example #5
0
 void Awake()
 {
     if (_instance != null)
     {
         Destroy(this.gameObject);
     }
     _instance = this;
 }
Example #6
0
 // Start is called before the first frame update
 void Start()
 {
     pauseUI = this;
     PauseText.SetActive(false);
     ContinueText.SetActive(false);
     Panel.SetActive(false);
     BackText.SetActive(false);
 }
Example #7
0
 void PauseGame()
 {
     pauseBG.SetActive(true);
     Cursor.visible   = true;
     Cursor.lockState = CursorLockMode.None;
     PauseUI.SetActive(true);
     gamePaused     = true;
     Time.timeScale = 0f;
 }
        public void Initialize(SceneType scene)
        {
            endFlag   = false;
            nextScene = scene;

            blurRate = 0.0f;

            ui = new PauseUI(gameManager, gameDevice);
        }
Example #9
0
 public void WinGame()
 {
     paused         = true;
     Time.timeScale = 0;
     EndTime        = Time.time - StartTime;
     NormalUI.SetActive(false);
     PauseUI.SetActive(false);
     winMenu.gameObject.SetActive(true);
     winMenu.UpdateWin();
 }
Example #10
0
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
Example #11
0
 public void Resume()
 {
     SoundController.Sound.Click();
     if (GameController.gameController.GameState == (int)GameState.PAUSE)
     {
         GameController.gameController.GameState = (int)GameState.PLAYING;
         NoSelect.SetActive(false);
         PauseUI.SetActive(false);
         Time.timeScale = 1;
     }
 }
Example #12
0
 public void Pause()
 {
     SoundController.Sound.Click();
     if (GameController.gameController.GameState == (int)GameState.PLAYING)
     {
         GameController.gameController.GameState = (int)GameState.PAUSE;
         NoSelect.SetActive(true);
         PauseUI.SetActive(true);
         Time.timeScale = 0;
     }
 }
Example #13
0
 public void Awake()
 {
     if (PauseUI.instance == null)
     {
         instance = this;
     }
     else if (this != instance)
     {
         Destroy(this.gameObject);
     }
 }
Example #14
0
 public void Pause()
 {
     foreach (Button btn in typeWordManager.keyboardBgColor.GetComponentsInChildren <Button>())
     {
         btn.interactable = false;
     }
     Time.timeScale = 0f;
     PauseUI.SetActive(true);
     typeWordManager.bonusWordCanvas.SetActive(false);
     wordsCanvas.SetActive(false);
     GameisPaused = true;
 }
Example #15
0
    //------------------------------------------------------------------------------------------------
    // Update is called once per frame
    void Update()
    {
        // Pressing the F10 key will toggle the Mouse's Locked mode and visibility.
        if (Input.GetKeyDown(KeyCode.F10))
        {
            PauseUI.getInstance().cursorToggle();
        }

        // Pressing the Escape key will toggle the pause menu.
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            PauseUI.getInstance().pauseToggle();
        }
    }
Example #16
0
    public void Resume()
    {
        if (PauseSettings.activeSelf)
        {
            PauseSettings.SetActive(false);
        }

        pauseBG.SetActive(false);
        Cursor.visible   = false;
        Cursor.lockState = CursorLockMode.Locked;
        PauseUI.SetActive(false);
        gamePaused     = false;
        Time.timeScale = 1f;
    }
Example #17
0
    public void Pause(bool pause)
    {
        if (pause)
        {
            u = UIState.PAUSE;
            Time.timeScale = 0;
            PauseUI.SetActive(true);
            NormalUI.SetActive(false);
            winMenu.gameObject.SetActive(false);
        }
        else
        {
            u = UIState.GAME;
            Time.timeScale = 1;
            PauseUI.SetActive(false);
            NormalUI.SetActive(true);
            winMenu.gameObject.SetActive(false);
        }

        paused = pause;
    }
Example #18
0
    /// <summary>
    /// Creates and initializes the shared objects.
    /// </summary>
    private void CreateSharedObjects()
    {
        m_faderUI  = CreateSharedUIFromPrefab <FaderUI>(FADER_UI_PREFAB_PATH);
        m_timerUI  = CreateSharedUIFromPrefab <TimerUI>(TIMER_UI_PREFAB_PATH);
        m_pauseUI  = CreateSharedUIFromPrefab <PauseUI>(PAUSE_UI_PREFAB_PATH);
        m_scoreUI  = CreateSharedUIFromPrefab <ScoreUI>(SCORE_UI_PREFAB_PATH);
        m_fasterUI = CreateSharedUIFromPrefab <FasterUI>(FASTER_UI_PREFAB_PATH);

        m_faderUI.transform.SetPosZ(-100000.0f);                // Instantiate outside camera view
        DontDestroyOnLoad(m_faderUI.gameObject);
        m_faderUI.Initialize();                                 // Hide (shared UI start hidden)
        m_faderUI.transform.SetPosZ(0.0f);                      // Restore position once hidden

        m_timerUI.transform.SetPosZ(-100000.0f);
        DontDestroyOnLoad(m_timerUI.gameObject);
        m_timerUI.Initialize();
        m_timerUI.transform.SetPosZ(0.0f);

        m_pauseUI.transform.SetPosZ(-100000.0f);
        DontDestroyOnLoad(m_pauseUI.gameObject);
        m_pauseUI.Initialize();
        m_pauseUI.transform.SetPosZ(0.0f);

        m_scoreUI.transform.SetPosZ(-100000.0f);
        DontDestroyOnLoad(m_scoreUI.gameObject);
        m_scoreUI.Initialize();
        m_scoreUI.transform.SetPosZ(0.0f);

        m_fasterUI.transform.SetPosZ(-100000.0f);
        DontDestroyOnLoad(m_fasterUI.gameObject);
        m_fasterUI.Initialize();
        m_fasterUI.transform.SetPosZ(0.0f);

        m_timerUI.Hide();
        m_pauseUI.Hide();
        m_scoreUI.Hide();
        m_fasterUI.Hide();
    }
Example #19
0
 // Update is called once per frame
 void Update()
 {
     if (Bird.gameStatus == Bird.GameStatus.DEAD || Bird.gameStatus == Bird.GameStatus.UPGRADING || Bird.gameStatus == Bird.GameStatus.PAUSED)
     {
         OnMenuButtonClick();
         if (Input.GetMouseButtonDown(0))
         {
             if (Input.mousePosition.y < dispalyHeight && Input.mousePosition.x < displayWidth)
             {
                 if (Bird.gameStatus != Bird.GameStatus.PAUSED)
                 {
                     SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
                 }
                 else
                 {
                     GameDetailsUI.SetActive(true);
                     PauseUI.SetActive(false);
                     Bird.gameStatus = Bird.GameStatus.PLAYING;
                 }
                 Time.timeScale = 1f;
             }
         }
     }
 }
Example #20
0
 public void ShutDown()
 {
     ui = null;
 }
 void Start()
 {
     Move    = this.transform.position;
     pauseui = GameObject.FindGameObjectWithTag("MainCamera").GetComponentInParent <PauseUI>();
 }
Example #22
0
 // Start is called before the first frame update
 void Start()
 {
     PauseCtl = GameObject.Find("MenuCtl").GetComponent <PauseUI>();
 }
Example #23
0
 public void GoOn()
 {
     PauseUI.SetActive(false);
     Time.timeScale = 1;
 }
Example #24
0
 public void Pause()
 {
     PauseUI.SetActive(true);
     Time.timeScale = 0;
 }