private void handlePlatformCollision(Collision2D coll) { if ((coll.gameObject.tag == Tags.TAG_PLATFORM || coll.gameObject.tag == "pref_collapsing_platform") && !visitedPlatforms.Contains(coll.gameObject) && this.transform.position.y > coll.gameObject.transform.position.y) { boostPlayer(); PlatformAchievement.incrementPlatformCount(); playerStatus.score.increaseScoreByPlatform(); visitedPlatforms.Add(coll.gameObject); } else if (coll.gameObject.tag == Tags.TAG_PLATFORM && this.transform.position.y > coll.gameObject.transform.position.y) { Vector2 jumpForce = new Vector2(0, Constants.DISTANCE_JUMP + playerStatus.FitnessLevel); rigidbody2D.velocity = Vector2.zero; rigidbody2D.AddForce(jumpForce); } }
//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); }
//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); }