Exemplo n.º 1
0
        private void Awake()
        {
            if (!UserPrefs.SessionActive())
            {
                _btnCancel.GetComponent <TextMeshProUGUI>().SetText("Done");
                _btnContinue.gameObject.SetActive(false);
            }

            SceneManager.activeSceneChanged += RemoveEvents;

            _values = new List <float>();

            GameObject        _coreGameBehaviourGameObject = new GameObject("CoreGameBehvaiour");
            CoreGameBehaviour _coreGameBehaviourScript     = _coreGameBehaviourGameObject.AddComponent <CoreGameBehaviour>();

            // Programmatically add button click events
            _btnContinue.onClick.AddListener(_coreGameBehaviourScript.LoadNextScene);

            _scoreData = FindObjectOfType <ScoreDataHolder>();

            // Know which scene script will ONLY live
            _scoreData.ParentScene = SceneManager.GetActiveScene().name;

            _scoreText.SetText($"{_scoreData.MinScore}/{_scoreData.MaxScore}");

            _graphContainer = transform.Find("GraphContainer").GetComponent <RectTransform>();

            ShowGraph(_scoreData.category, _scoreData.MinScore, _scoreData.MaxScore);
        }
Exemplo n.º 2
0
        public void ShowGraph(UserStat.GameCategory category, float score, float maxScore)
        {
            GameObject _scoreDataHolderGameObject = new GameObject("ScoreDataHolder_Temp");

            _scoreDataHolderGameObject.AddComponent <ScoreDataHolder>();

            ScoreDataHolder _dataHolder = _scoreDataHolderGameObject.GetComponent <ScoreDataHolder>();

            _dataHolder.GameObjectHolder = _scoreDataHolderGameObject;
            _dataHolder.MaxScore         = (int)maxScore;
            _dataHolder.MinScore         = (int)score;
            _dataHolder.category         = category;

            SceneManager.LoadScene("Remark");
        }