2023-05-11 19:04:02 +00:00
|
|
|
#include "pico/stdlib.h"
|
|
|
|
#include "i2c_annexe.h"
|
|
|
|
#include "Score.h"
|
|
|
|
|
|
|
|
#define SCORE_INITIAL 5
|
|
|
|
|
|
|
|
uint32_t Score_nb_cerises=0;
|
|
|
|
uint32_t Score_nb_points=0;
|
|
|
|
uint32_t Score_funny_action=0;
|
2023-05-20 01:41:02 +00:00
|
|
|
uint32_t Score_gateau=0;
|
2023-05-11 19:04:02 +00:00
|
|
|
uint32_t Score_pieds_dans_plat=0;
|
|
|
|
|
|
|
|
void Score_recalcule(){
|
|
|
|
Score_nb_points = SCORE_INITIAL;
|
|
|
|
if(Score_nb_cerises > 0){
|
|
|
|
Score_nb_points += Score_nb_cerises + 5;
|
|
|
|
}
|
|
|
|
Score_nb_points += Score_funny_action;
|
|
|
|
Score_nb_points += Score_pieds_dans_plat;
|
2023-05-20 01:41:02 +00:00
|
|
|
Score_nb_points += Score_gateau;
|
2023-05-11 19:04:02 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void Score_actualise(){
|
|
|
|
Score_recalcule();
|
|
|
|
i2c_annexe_envoie_score(Score_nb_points);
|
|
|
|
}
|
|
|
|
|
2023-05-20 01:41:02 +00:00
|
|
|
void Score_ajout_gateau(uint32_t nb_gateau){
|
|
|
|
Score_gateau += nb_gateau;
|
|
|
|
Score_actualise();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-05-11 19:04:02 +00:00
|
|
|
void Score_set_funny_action(){
|
|
|
|
Score_funny_action = 5;
|
|
|
|
Score_actualise();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Score_set_pieds_dans_plat(){
|
|
|
|
Score_pieds_dans_plat = 15;
|
|
|
|
Score_actualise();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Score_ajout_cerise(uint32_t nb_cerises){
|
|
|
|
Score_nb_cerises += nb_cerises;
|
|
|
|
Score_actualise();
|
|
|
|
}
|