public static void handleCollision(Mario mario, IEnemyObject enemy, ICollision side, LevelStorage levelStorage) { ICommand command; if (!(side.returnCollisionSide().Equals(CollisionSide.None))) { handleMarioMovement(mario, enemy, side); } if (side.returnCollisionSide().Equals(CollisionSide.Top) && enemy.canHurtMario()) { command = new MarioHitsEnemyCollision(enemy, mario); command.Execute(); levelStorage.decreaseEnemyCount(); } else if (!(side.returnCollisionSide().Equals(CollisionSide.None)) && enemy.canHurtMario()) { command = new EnemyHitsMarioCollision(mario, enemy); command.Execute(); if (!mario.Star) { StatePuaseAlterationCall.Execute(); } } if (enemy.canHurtOtherEnemies() && !(side.returnCollisionSide().Equals(CollisionSide.None)) && !enemy.canHurtMario()) { handleMarioMovement(mario, enemy, side); handleEnemyMovement(enemy, side); } handleAchievement(enemy, side); }
private static void handleAchievement(IEnemyObject enemy, ICollision side) { if (side.returnCollisionSide().Equals(CollisionSide.Top) && enemy.canHurtMario()) { AchievementEventTracker.killingEnemyAcievement(); } }