Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using Microsoft.Xna.Framework.Content;
- using Microsoft.Xna.Framework;
- using Microsoft.Xna.Framework.Input;
- using Microsoft.Xna.Framework.Graphics;
- namespace Projet
- {
- class ScoreManager
- {
- private static float comboDuration = 5f, comboTimer;
- public static string CalculateTimeSpent(float secondSpent)
- {
- int seconds = (int)secondSpent;
- string timeSpent = seconds / 60 + " '' " + seconds % 60;
- return timeSpent;
- }
- public static int ScoreToStars(int score)
- {
- int nbIAs = LevelLoader.iaList.Count;
- int bestScore = 0;
- if (nbIAs > 0)
- {
- if (nbIAs <= 5)
- for (int i = 1; i <= nbIAs; i++) bestScore += 100 * i;
- else
- bestScore = 500 * (nbIAs - 2);
- if (score < bestScore / 6)
- return 0;
- else if (score < 2 * bestScore / 6)
- return 1;
- else if (score < 3 * bestScore / 6)
- return 2;
- else if (score < 4 * bestScore / 6)
- return 3;
- else if (score < 5 * bestScore / 6)
- return 4;
- else if (score <= bestScore)
- return 5;
- else
- return 0;
- }
- else
- {
- return 5;
- }
- }
- public static void RestartComboTimer()
- {
- comboTimer = 0f;
- }
- public static void UpdateComboTimer(GameTime gameTime)
- {
- if (comboTimer > comboDuration)
- {
- Level.combo = -1;
- comboTimer = 0f;
- }
- else
- comboTimer += (float)gameTime.ElapsedGameTime.TotalSeconds;
- }
- public static void UpdateCombo()
- {
- if (comboTimer < comboDuration)
- {
- if (Level.combo > 0)
- Level.score += 100 + Level.combo * 100;
- if (Level.combo < 4)
- Level.combo++;
- }
- else
- Level.combo = -1;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment