Esempio n. 1
0
        private Vector2 GetRawMoveVector()
        {
            Vector2 move = Vector2.zero;

            move.x = _controller.GetAxis(m_HorizontalAxis);
            move.y = _controller.GetAxis(m_VerticalAxis);

            if (_controller.GetButtonDown(m_HorizontalAxis))
            {
                if (move.x < 0)
                {
                    move.x = -1f;
                }
                if (move.x > 0)
                {
                    move.x = 1f;
                }
            }
            if (DadaInput.GetButtonDown(m_VerticalAxis))
            {
                if (move.y < 0)
                {
                    move.y = -1f;
                }
                if (move.y > 0)
                {
                    move.y = 1f;
                }
            }
            return(move);
        }
Esempio n. 2
0
    void Update()
    {
        bool startPressed = DadaInput.GetButtonDown(VirtualKey.START);


        //Pause game
        if (!_isPaused && startPressed && !_gameEnded)
        {
            Time.timeScale = 0.0000001f;
            _isPaused      = true;
            _pauseScreen.gameObject.SetActive(true);
        }
        else if (_isPaused)
        {
            //resume game
            if (startPressed)
            {
                Time.timeScale = 1;
                _isPaused      = false;
                _pauseScreen.gameObject.SetActive(false);
            }
            else if (DadaInput.GetButtonDown(VirtualKey.SELECT))
            {
                Time.timeScale = 1;
                _isPaused      = false;
                DadaGame.Reset();
                Application.LoadLevel("MainScreen");
            }
        }

        //game ended.
        if (_gameEnded)
        {
            if (_controller1.GetButtonDown(VirtualKey.LEFT) && !_restartYes.IsFading)
            {
                _restartYes.Fade();
                _restartNo.Stop(1, 0);
                _restartYes.GetComponent <Text>().color = _teams[_winningTeam].TeamColor;
                _restartNo.GetComponent <Text>().color  = Color.white;
            }

            if (_controller1.GetButtonDown(VirtualKey.RIGHT) && !_restartNo.IsFading)
            {
                _restartNo.Fade();
                _restartYes.Stop(1, 0);
                _restartNo.GetComponent <Text>().color  = _teams[_winningTeam].TeamColor;
                _restartYes.GetComponent <Text>().color = Color.white;
            }

            if (_controller1.GetButtonDown(VirtualKey.SUBMIT))
            {
                if (_restartYes.IsFading)
                {
                    Application.LoadLevel(Application.loadedLevelName);
                }
                else
                {
                    Application.LoadLevel("MainScreen");
                }
            }
        }
    }