Exemple #1
0
    // Update is called once per frame
    void Update()
    {
        string score = Convert.ToString(_getScore.getScore());

        if (_getGameStatu.queryGameStatus() == GameStatus.fail)
        {
            gameStatuText.GetComponent <Text>().text = "fail!";
        }
        else if (_getGameStatu.queryGameStatus() == GameStatus.win)
        {
            gameStatuText.GetComponent <Text>().text = "win!";
        }
        scoreText.GetComponent <Text>().text = "Score:" + score;
    }
Exemple #2
0
    // Update is called once per frame
    void Update()
    {
        _gameStatus   = _queryStatus.queryGameStatus();
        _scenceStatus = _queryStatus.queryScenceStatus();

        if (_gameStatus == GameStatus.ing)
        {
            if (_scenceStatus == ScenceStatus.waiting && Input.GetKeyDown("space"))
            {
                _uerInterface.sendDisk();
            }
            if (_scenceStatus == ScenceStatus.shooting && Input.GetMouseButtonDown(0))
            {
                Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
                RaycastHit hit;
                if (Physics.Raycast(ray, out hit) && hit.collider.gameObject.tag == "Disk")
                {
                    _uerInterface.destroyDisk(hit.collider.gameObject);
                    _Score.addScore();
                }
            }
        }
        else
        {
            //reset
            if (Input.GetKeyDown("space"))
            {
                if (_gameStatus == GameStatus.load)
                {
                    _controller.setGameStatus(GameStatus.ing);
                }
                else
                {
                    _controller.setGameStatus(GameStatus.load);
                    _Score.reset();
                    Debug.Log("reseting");
                }
            }
        }
    }