コード例 #1
0
        public void UpdateVisualisation(byte envStatus, GameManagerState GameState,
                                        MoreOrLess.InternalState internalState, int accessCode, Question _currentQuestion,
                                        AnswerParameters _currentAnswer, int nScore,
                                        int nTotalGameSecs, int nRemainingSecs, int nRemainingQuestionSecs)
        {
            VisualisationData vd = new VisualisationData();

            vd.EnvironmentStatus = envStatus;
            vd.GameState         = GameState.ToString();
            vd.GameStateInt      = (int)GameState;
            vd.InternalState     = internalState.ToString();
            vd.InternalStateInt  = (int)internalState;
            vd.AccessCode        = accessCode;

            if (_currentQuestion != null)
            {
                vd.currentQuestion = _currentQuestion;
            }

            if (_currentAnswer != null)
            {
                vd.currentQuestionMin = _currentAnswer.GetMin();
                vd.currentQuestionMax = _currentAnswer.GetMax();
                vd.currentAnswerLo    = _currentAnswer.GetLo();
                vd.currentAnswerHi    = _currentAnswer.GetHi();
                vd.PotentialScore     = _currentAnswer.GetPotentialPoints();
            }

            vd.Score                 = nScore;
            vd.TotalGameSecs         = nTotalGameSecs;
            vd.RemainingSecs         = nRemainingSecs;
            vd.RemainingQuestionSecs = nRemainingQuestionSecs;

            WriteToVizServer(vd);

            if (m_bUseFileSystem)
            {
                if (!IsClientReceiving() || IsVisFileAlreadyPresent())
                {
                    _vdPending = vd;
                    _dogPendingUpdate.Reset();
                    return;
                }

                WriteToVizFile(vd);
            }
        }
コード例 #2
0
    void Update()
    {
        if (Input.GetKey(KeyCode.Return) && string.Compare(GameState.ToString(), "Opening") == 0)
        {
            GameState = GameManagerState.StartScreen;
            UpdateGameState();
        }

        if (Input.GetKey(KeyCode.Return) && string.Compare(GameState.ToString(), "GameOver") == 0)
        {
            SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
        }

        if (string.Compare(GameState.ToString(), "StartScreen") == 0)
        {
            StartUI.transform.position = Vector3.Lerp(StartUI.transform.position, new Vector3(StartUI.transform.position.x, 1600f, StartUI.transform.position.z), Time.deltaTime * 1.5f);
            StartCoroutine(ScreenTwoAnimation());
        }

        if (Input.GetKey(KeyCode.Return) && string.Compare(GameState.ToString(), "StartScreen") == 0 && CanIStart)
        {
            StartCoroutine(CountDown());
        }

        if (GameObject.FindGameObjectWithTag("Player"))
        {
            GameObject PlayerObject = GameObject.FindGameObjectWithTag("Player");
            foreach (GameObject road in GameObject.FindGameObjectsWithTag("Road"))
            {
                if (road.transform.position.z + 150f < PlayerObject.transform.position.z)
                {
                    Destroy(road);
                    SpawnRoad();
                }
            }

            foreach (GameObject tree in GameObject.FindGameObjectsWithTag("tree"))
            {
                if (tree.transform.position.z + 150f < PlayerObject.transform.position.z)
                {
                    Destroy(tree);
                }
            }


            foreach (GameObject Obsticle in GameObject.FindGameObjectsWithTag("Obsticle"))
            {
                if (Obsticle.transform.position.z + 150f < PlayerObject.transform.position.z)
                {
                    Destroy(Obsticle);
                }
            }

            foreach (GameObject Point in GameObject.FindGameObjectsWithTag("Point"))
            {
                if (Point.transform.position.z + 150f < PlayerObject.transform.position.z)
                {
                    Destroy(Point);
                }
            }
        }

        else if (!GameObject.FindGameObjectWithTag("Player") && string.Compare(GameState.ToString(), "Play") == 0)
        {
            StartCoroutine(DestroyAllObjects());
            StartCoroutine(StartGameOver());
        }
    }