public float calculatePoints() { float multiplier = 0; switch (phase) { case pointsCalculationPhases.NONE: points = base_points * 10; outputText = "Puntos base: " + base_points + " puntos x 10 = " + points; phase = pointsCalculationPhases.BASE; multiplier = 10; break; case pointsCalculationPhases.BASE: float percentTimeLeft = (total_time - time_spent) / total_time; //0->1 float timeExtra = roundToTwo(1.0f + (percentTimeLeft * 9.0f)); points = points * timeExtra; outputText += "\nTiempo: " + (percentTimeLeft * 100) + "% restante. x" + timeExtra + " = " + points; phase = pointsCalculationPhases.TIME; multiplier = timeExtra; break; case pointsCalculationPhases.TIME: float livesLeftPoints = roundToTwo((remaining_lives * 0.25f) + 0.75f); points = points * livesLeftPoints; outputText += "\nVidas: " + remaining_lives + " de 3. x" + livesLeftPoints + " = " + points; phase = pointsCalculationPhases.LIFE; multiplier = livesLeftPoints; break; case pointsCalculationPhases.LIFE: float colectPoints; switch (colectionables_taken) { case 1: colectPoints = 1.5f; break; case 2: colectPoints = 2.5f; break; case 3: colectPoints = 4f; break; default: colectPoints = 1; break; } points = points * colectPoints; outputText += "\nColeccionables: " + colectionables_taken + " de 3. x" + colectPoints + " = " + points; phase = pointsCalculationPhases.COLLECTIBLES; multiplier = colectPoints; break; case pointsCalculationPhases.COLLECTIBLES: //PACIFIST if (num_enemies > 0 && enemies_defeated == 0) { points = points * 3.0f; outputText += "\nPacifista. x3 = " + points; multiplier = 3.0f; } phase = pointsCalculationPhases.PACIFIST; break; case pointsCalculationPhases.PACIFIST: //GENOCIDE if (num_enemies > 0 && enemies_defeated == num_enemies) { points = points * 4.0f; outputText += "\nGenocida. x4 = " + points; multiplier = 4.0f; } phase = pointsCalculationPhases.GENOCIDE; break; case pointsCalculationPhases.GENOCIDE: //PERMADEATH if (!checkpoint_used) { points = points * 10.0f; outputText += "\nPermadeath. x10 = " + points; multiplier = 10.0f; } phase = pointsCalculationPhases.PERMADEATH; break; case pointsCalculationPhases.PERMADEATH: //GODMODE if (death_positions.Count == 0) { points = points * 15.0f; outputText += "\nGodMode. x15 = " + points; multiplier = 15.0f; } phase = pointsCalculationPhases.GODMODE; break; case pointsCalculationPhases.GODMODE: //COMBO if (combo_done) { points = points * 1.25f; outputText += "\nCombo. x1.2 = " + points; multiplier = 1.25f; } phase = pointsCalculationPhases.COMBO; break; case pointsCalculationPhases.COMBO: //JINXED if (jinxed) { points = points * 1.12f; outputText += "\nJinxed. x1.12 = " + points; multiplier = 1.12f; } phase = pointsCalculationPhases.JINXED; break; case pointsCalculationPhases.JINXED: //LAAGGG if (time_SFPS_used >= 20f) { points = points * 1.15f; outputText += "\nLAAGGGGGG. x1.15 = " + points; multiplier = 1.15f; } phase = pointsCalculationPhases.LAG; break; case pointsCalculationPhases.LAG: if (times_retry > 0) { points = points / (2 * times_retry); outputText += "\nRetry penalty: / " + (2 * times_retry) + " = " + points; multiplier = (2 * times_retry); } phase = pointsCalculationPhases.PENALTY; break; case pointsCalculationPhases.PENALTY: outputText += "\nFINAL POINTS: " + points; finalPoints = points; phase = pointsCalculationPhases.NONE; break; default: break; } return multiplier; }
public float calculatePoints() { float multiplier = 0; switch (phase) { case pointsCalculationPhases.NONE: points = base_points * 10; outputText = "Puntos base: " + base_points + " puntos x 10 = " + points; phase = pointsCalculationPhases.BASE; multiplier = 10; break; case pointsCalculationPhases.BASE: float percentTimeLeft = (total_time - time_spent) / total_time; //0->1 float timeExtra = roundToTwo(1.0f + (percentTimeLeft * 9.0f)); points = points * timeExtra; outputText += "\nTiempo: " + (percentTimeLeft * 100) + "% restante. x" + timeExtra + " = " + points; phase = pointsCalculationPhases.TIME; multiplier = timeExtra; break; case pointsCalculationPhases.TIME: float livesLeftPoints = roundToTwo((remaining_lives * 0.25f) + 0.75f); points = points * livesLeftPoints; outputText += "\nVidas: " + remaining_lives + " de 3. x" + livesLeftPoints + " = " + points; phase = pointsCalculationPhases.LIFE; multiplier = livesLeftPoints; break; case pointsCalculationPhases.LIFE: float colectPoints; switch (colectionables_taken) { case 1: colectPoints = 1.5f; break; case 2: colectPoints = 2.5f; break; case 3: colectPoints = 4f; break; default: colectPoints = 1; break; } points = points * colectPoints; outputText += "\nColeccionables: " + colectionables_taken + " de 3. x" + colectPoints + " = " + points; phase = pointsCalculationPhases.COLLECTIBLES; multiplier = colectPoints; break; case pointsCalculationPhases.COLLECTIBLES: //PACIFIST if (num_enemies > 0 && enemies_defeated == 0) { points = points * 3.0f; outputText += "\nPacifista. x3 = " + points; multiplier = 3.0f; } phase = pointsCalculationPhases.PACIFIST; break; case pointsCalculationPhases.PACIFIST: //GENOCIDE if (num_enemies > 0 && enemies_defeated == num_enemies) { points = points * 4.0f; outputText += "\nGenocida. x4 = " + points; multiplier = 4.0f; } phase = pointsCalculationPhases.GENOCIDE; break; case pointsCalculationPhases.GENOCIDE: //PERMADEATH if (!checkpoint_used) { points = points * 10.0f; outputText += "\nPermadeath. x10 = " + points; multiplier = 10.0f; } phase = pointsCalculationPhases.PERMADEATH; break; case pointsCalculationPhases.PERMADEATH: //GODMODE if (death_positions.Count == 0) { points = points * 15.0f; outputText += "\nGodMode. x15 = " + points; multiplier = 15.0f; } phase = pointsCalculationPhases.GODMODE; break; case pointsCalculationPhases.GODMODE: //COMBO if (combo_done) { points = points * 1.25f; outputText += "\nCombo. x1.2 = " + points; multiplier = 1.25f; } phase = pointsCalculationPhases.COMBO; break; case pointsCalculationPhases.COMBO: //JINXED if (jinxed) { points = points * 1.12f; outputText += "\nJinxed. x1.12 = " + points; multiplier = 1.12f; } phase = pointsCalculationPhases.JINXED; break; case pointsCalculationPhases.JINXED: //LAAGGG if (time_SFPS_used >= 20f) { points = points * 1.15f; outputText += "\nLAAGGGGGG. x1.15 = " + points; multiplier = 1.15f; } phase = pointsCalculationPhases.LAG; break; case pointsCalculationPhases.LAG: if (times_retry > 0) { points = points / (2 * times_retry); outputText += "\nRetry penalty: / " + (2 * times_retry) + " = " + points; multiplier = (2 * times_retry); } phase = pointsCalculationPhases.PENALTY; break; case pointsCalculationPhases.PENALTY: outputText += "\nFINAL POINTS: " + points; finalPoints = points; phase = pointsCalculationPhases.NONE; break; default: break; } return(multiplier); }