Exemplo n.º 1
0
        public void UpdateInfos()
        {
            if (!DataManipulators.MainData.GetInstance().myLevelData.ContainsKey(levelKey))
            {
                return;
            }

            DataManipulators.MainData.LevelProps localLP = DataManipulators.MainData.GetInstance().myLevelData[levelKey];

            float ratio = localLP.LevelImage.rect.width / localLP.LevelImage.rect.height;

            if (160f / 90f > ratio)
            {
                MapImage.rectTransform.sizeDelta = new Vector2(90 * ratio, 90);
            }
            else
            {
                MapImage.rectTransform.sizeDelta = new Vector2(160, 160 / ratio);
            }

            MapImage.sprite  = localLP.LevelImage;
            MapNameText.text = localLP.LevelName;

            MaxScoreText.text = DataManipulators.MainData.GetInstance().GetMaxScore(
                DataManipulators.MainData.GetInstance().GetMainPlayer(),
                localLP.LevelName, localLP.LevelHash).ToString();
        }
Exemplo n.º 2
0
        public void GameOver(Player inPlayer)
        {
            myPlayer = inPlayer;

            if (!TestMode)
            {
                DataManipulators.MainData.LevelProps localLP = DataManipulators.MainData.GetInstance().GetCurrentLevel();
                DataManipulators.MainData.GetInstance().SetMaxScore((int)Points, localLP.LevelName, localLP.LevelHash);
            }

            EndScreen.SetActive(true);
        }
Exemplo n.º 3
0
        public void NewGame()
        {
            EndScreen.SetActive(false);
            if (myPlayer)
            {
                myPlayer.PlayerSpawn(spawnTransform.position);
                UpdatePlayerStats(myPlayer);
            }

            Points          = 0;
            PointsText.text = "0";


            if (!TestMode)
            {
                DataManipulators.MainData.LevelProps localLP = DataManipulators.MainData.GetInstance().GetCurrentLevel();

                BestScoreText.text = DataManipulators.MainData.GetInstance().GetMaxScore(
                    DataManipulators.MainData.GetInstance().GetMainPlayer(),
                    localLP.LevelName, localLP.LevelHash).ToString();
            }

            Ball[] myBalls = GameObject.FindObjectsOfType <Ball>();
            for (int i = myBalls.Length - 1; i > -1; --i)
            {
                myBalls[i].BallDestroy();
            }

            HUD_Emergency[] myEms = GameObject.FindObjectsOfType <HUD_Emergency>();
            for (int i = myEms.Length - 1; i > -1; --i)
            {
                myEms[i].gameObject.SetActive(false);
            }

            EventTimer = AvarageEventTime + Random.Range(-DeltaEventTime, DeltaEventTime);
        }
Exemplo n.º 4
0
        public void AddPoints(float inPoints)
        {
            Points += inPoints * ScoreMultiplyer;

            PointsText.text = Mathf.FloorToInt(Points).ToString();


            if (!TestMode)
            {
                DataManipulators.MainData.LevelProps localLP = DataManipulators.MainData.GetInstance().GetCurrentLevel();


                int MaxPoints = DataManipulators.MainData.GetInstance().GetMaxScore(
                    DataManipulators.MainData.GetInstance().GetMainPlayer(),
                    localLP.LevelName, localLP.LevelHash);

                if (Points > MaxPoints)
                {
                    DataManipulators.MainData.GetInstance().SetMaxScore((int)Points, localLP.LevelName, localLP.LevelHash);

                    BestScoreText.text = Mathf.FloorToInt(Points).ToString();
                }
            }
        }