Ejemplo n.º 1
0
        public IEnumerator ShouldPurchaseShip()
        {
            sm.AddCash(100000000);
            sm.PurchaseShip(Tags.CELLEX);
            yield return(new WaitForSeconds(TestConstants.WAIT_TIME));

            Assert.AreEqual(Tags.CELLEX, sm.GetSelectedShipData().GetShipName());
            Assert.True(sm.IsShipUnlocked(sm.GetSelectedShipData()));
        }
Ejemplo n.º 2
0
        private void OnCollisionEnter(Collision other)
        {
            switch (other.gameObject.tag)
            {
            case Tags.OBSTACLE:
                if (IsGodMode())
                {
                    achievementManager.UnlockAchievement(AchievementIds.FLY_THROUGH_OBSTACLE_WHEN_INVINCIBLE);
                    return;
                }

                dead = true;

                GameObject e = Instantiate(explosion) as GameObject;
                e.transform.SetPosition(new Vector3(transform.position.x, 0.6f, transform.position.z));

                int topSpeed      = playerControl.GetSpeed();
                int finalScore    = playerScore.GetFinalScore();
                int bonusScore    = playerScore.GetBonusScore();
                int distanceScore = playerScore.GetDistanceScore();

                Destroy(e, 3f);

                playerControl.StopMoving();
                playerModel.SetActive(false);
                hud.SetNewHighscoreText("");
                gameHUD.SetActive(false);

                audioManager.Play(SoundNames.PLAYER_DEATH);
                audioManager.Pause(SoundNames.SHIP_ENGINE);

                shopManager.AddCash(finalScore);

                scoreboard.Show();
                scoreboard.AnimateDistanceScore(distanceScore);
                scoreboard.AnimateBonusScore(bonusScore);
                scoreboard.AnimateTopSpeed(topSpeed);
                scoreboard.AnimateFinalScore(finalScore);

                bool newScore    = highscoreManager.SaveLocalHighscore(finalScore);
                bool newDistance = highscoreManager.SaveDistanceHighscore(distanceScore);

                if (newScore || newDistance)
                {
                    hud.SetNewHighscoreText(Ui.NEW_HIGHSCORE);
                    audioManager.Play(SoundNames.NEW_HIGHSCORE);
                }

                // Now update achievements
                achievementManager.ProgressAchievement(AchievementIds.DISTANCE_FURTHER_THAN_1000, 1000, distanceScore);
                achievementManager.ProgressAchievement(AchievementIds.DISTANCE_FURTHER_THAN_10000, 10000, distanceScore);
                achievementManager.ProgressAchievement(AchievementIds.DISTANCE_FURTHER_THAN_50000, 50000, distanceScore);
                achievementManager.ProgressAchievement(AchievementIds.POINTS_OVER_FIVE_MILLION, 5000000, finalScore);
                achievementManager.ProgressAchievement(AchievementIds.POINTS_OVER_HALF_MILLION, 500000, finalScore);
                achievementManager.ProgressAchievement(AchievementIds.POINTS_OVER_MILLION, 1000000, finalScore);
                achievementManager.UnlockAchievement(AchievementIds.DIE);

                StartCoroutine(RestartLevelRoutine());
                break;

            default:
                // Nothing to do!
                break;
            }
        }