コード例 #1
0
        void AddLapRow()
        {
            Vector2 sizeDelta = rectTransform.sizeDelta;

            sizeDelta.y += rowHeight;

            rectTransform.sizeDelta = sizeDelta;

            lapLabel      = GameObject.Instantiate(lapLabelPrefab).GetComponent <Text>();
            lapLabel.text = string.Format(Constants.LapLabelFormat, RaceManager.GetLapCount());

            lapLabel.gameObject.transform.SetParent(column1.transform);
            lapLabel.transform.localScale = Vector2.one;

            lapElapsedTime      = GameObject.Instantiate(elapsedLapTimePrefab).GetComponent <Text>();
            lapElapsedTime.text = Constants.ElapsedLapTime;

            lapElapsedTime.gameObject.transform.SetParent(column2.transform);
            lapElapsedTime.transform.localScale = Vector2.one;

            GameObject blank = GameObject.Instantiate(raceInfoHudBlankPrefab);

            blank.transform.SetParent(column3.transform);
            blank.transform.localScale = Vector2.one;

            blank = GameObject.Instantiate(raceInfoHudBlankPrefab);

            blank.transform.SetParent(column4.transform);
            blank.transform.localScale = Vector2.one;

            blank = GameObject.Instantiate(raceInfoHudBlankPrefab);

            blank.transform.SetParent(column5.transform);
            blank.transform.localScale = Vector2.one;
        }
コード例 #2
0
ファイル: RaceUI.cs プロジェクト: phi-lira/JetBoard
        public void Setup(int player)
        {
            _playerIndex  = player;
            _boat         = RaceManager.RaceData.boats[_playerIndex].Boat;
            _totalLaps    = RaceManager.GetLapCount();
            _totalPlayers = RaceManager.RaceData.boats.Count;
            _timeOffset   = Time.time;

            switch (AppSettings.Instance.speedFormat)
            {
            case AppSettings.SpeedFormat._Kph:
                _speedFormat         = AppSettings.SpeedFormat._Kph;
                speedFormatText.text = "kph";
                break;

            case AppSettings.SpeedFormat._Mph:
                _speedFormat         = AppSettings.SpeedFormat._Mph;
                speedFormatText.text = "mph";
                break;
            }

            StartCoroutine(SetupPlayerMarkers(player));
            StartCoroutine(SetupPlayerMapMarkers());
            StartCoroutine(CreateGameStats());
        }
コード例 #3
0
        IEnumerator WatchRaceStatus()
        {
            ResetHud();

            totalLapsText.text = RaceManager.GetTotalLaps().ToString();

            while (RaceManager.IsRaceInProgress() == true)
            {
                if (lapCount != RaceManager.GetLapCount())
                {
                    AddLapRow();

                    lapCount = RaceManager.GetLapCount();
                }

                UpdateElapsedTime(RaceManager.GetElapsedSec());
                UpdateLapElapsedTime(RaceManager.GetLapElapsedSec());

                yield return(null);
            }
        }