Inheritance: Achievement
    private void handleItemCollision(Collider2D other)
    {
        if (other.gameObject.tag == Tags.TAG_VEGETABLE)
        {
            other.gameObject.SetActive(false);
            if (playerStatus.FitnessLevel < playerStatus.MaxFitnessLevel)
            {
                HealthyFood healthyFood = other.gameObject.GetComponent <HealthyFood>();
                healthyFood.modifyFitnessLevel(playerStatus, Constants.VEGETABLE_FITNESS_CHANGE);
            }
            if (playerStatus.weight > playerStatus.minWeight)
            {
                playerStatus.weight += Constants.VEGETABLE_WEIGHT_CHANGE;
            }

            PlayEatAppleSound();

            ItemAchievement.incrementItemCount();
            playerStatus.handleVegetableCollision();
            gameObject.transform.localScale = new Vector3(playerStatus.weight, playerStatus.weight, 1);
        }
        if (other.gameObject.tag == Tags.TAG_CANDY)
        {
            Destroy(other.gameObject);
            if (playerStatus.FitnessLevel > playerStatus.MinFitenessLevel)
            {
                JunkFood junkfood = other.gameObject.GetComponent <JunkFood>();
                junkfood.modifyFitnessLevel(playerStatus, Constants.CANDY_FITNESS_CHANGE);
            }
            if (playerStatus.weight < playerStatus.MaxWeight)
            {
                playerStatus.weight += Constants.CANDY_WEIGHT_CHANGE;
            }

            PlayEatCandySound();

            ItemAchievement.incrementItemCount();
            playerStatus.handleJunkFoodCollision();
            gameObject.transform.localScale = new Vector3(playerStatus.weight, playerStatus.weight, 1);
        }
        if (other.gameObject.tag == Tags.TAG_FLAG)
        {
            PlayAchievement.incrementPlayCount();
            PlayerPrefs.SetInt("Finished", 1);
            if (playerStatus.score.getScore() > PlayerPrefs.GetInt(PlayerPrefs.GetString("HighScore5")))
            {
                Application.LoadLevel("highscore");
            }
            else
            {
                Application.LoadLevel("ExitSuccess");
            }
        }
    }
 void OnBecameInvisible()
 {
     PlayAchievement.incrementPlayCount();
     if (transform.position.y <= -Camera.main.camera.orthographicSize)
     {
         PlayerPrefs.SetInt("Finished", 0);
         if (playerStatus.score.getScore() > PlayerPrefs.GetInt(PlayerPrefs.GetString("HighScore5")))
         {
             ;
             Application.LoadLevel("highscore");
         }
         else
         {
             Application.LoadLevel("Exitfailed");
         }
     }
 }
	//Build list of achievements, with the key being a string of the goal
	public void makeAchievements() {

		string tempPlatformKey = "Bounced on 100 platforms!";
		PlatformAchievement tempPlatform = new PlatformAchievement(tempPlatformKey, 100);
		achievementList.Add(tempPlatform);

		string tempItemKey = "Picked up 50 items!";
		ItemAchievement tempItem = new ItemAchievement(tempItemKey, 50);
		achievementList.Add (tempItem);
		
		string tempPlayKey = "Played 10 times!";
		PlayAchievement tempPlay = new PlayAchievement(tempPlayKey, 10);
		achievementList.Add (tempPlay);

		string tempEnemyKey = "Defeat 20 enemies!";
		EnemyAchievement tempEnemy = new EnemyAchievement (tempEnemyKey, 20);
		achievementList.Add (tempEnemy);

	}
Esempio n. 4
0
    //Build list of achievements, with the key being a string of the goal
    public void makeAchievements()
    {
        string tempPlatformKey           = "Bounced on 100 platforms!";
        PlatformAchievement tempPlatform = new PlatformAchievement(tempPlatformKey, 100);

        achievementList.Add(tempPlatform);

        string          tempItemKey = "Picked up 50 items!";
        ItemAchievement tempItem    = new ItemAchievement(tempItemKey, 50);

        achievementList.Add(tempItem);

        string          tempPlayKey = "Played 10 times!";
        PlayAchievement tempPlay    = new PlayAchievement(tempPlayKey, 10);

        achievementList.Add(tempPlay);

        string           tempEnemyKey = "Defeat 20 enemies!";
        EnemyAchievement tempEnemy    = new EnemyAchievement(tempEnemyKey, 20);

        achievementList.Add(tempEnemy);
    }