Skip to content

Commit

Permalink
Merge pull request #30 from lasdpc-games/tabela-taco
Browse files Browse the repository at this point in the history
Tabela Brasileira de Composição de Alimentos adicionada como a base de dados de alimentos
  • Loading branch information
cirillom authored Oct 26, 2022
2 parents 8bdbd34 + f32252f commit b1169e2
Show file tree
Hide file tree
Showing 10 changed files with 75 additions and 63 deletions.
92 changes: 46 additions & 46 deletions unity-project/Assets/Resources/FoodDB.csv
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
;Peso;Medida;Calorias;Carbs;Gordura;Proteina;Consumo;Processing
Pizza;250;g;300;35;12;13;15;0.08
Hamburguer;400;g;480;50;40;30;10;0.08
Coxinha;80;g;65;0;3;0;3;0.1
Hot-dog;400;g;290;31;26;2;5;0.1
Batata-frita;100;g;225;28;11;4;5;0.1
Doritos;60;g;150;17;7;2;5;0.2
Pipoca;100;g;375;74;4;11;4;0.8
Milk-shake;230;ml;271;31;12;7;10;0.1
Sorvete;60;g;126;15;6;2;5;0.1
Bolo;100;g;371;53;15;5;3;0.1
Doce de leite;20;g;72;13;1;2;1;0.02
Brigadeiro;11;g;37;6;1;1;1;0.05
Ovo mexido;40;g;57;0;4;5;5;0.01
Ovo frito;50;g;120;1;9;8;6;0.01
Misto quente;100;g;321;21;21;7;5;0.04
Tapioca;100;g;220;55;0;0;10;0.01
Queijo;122;g;365;4;29;8;5;0.02
Maçã;120;g;66;17;0;0;3;0
Banana;118;g;105;27;0;1;2;0
Mamão;150;g;58;15;0;1;2;0
Abacate;100;g;96;9;12;1;2;0
Laranja;90;g;62;15;0;1;2;0
Morango;50;g;15;4;0;1;2;0.03
Leite;200;ml;114;9;6;6;2;0.05
Café;60;ml;18;0;0;0;1;0.02
Suco de laranja;200;ml;72;17;0;1;2;0.01
Refrigerante;200;ml;93;23;1;1;2;0.1
Arroz;100;g;109;24;0;2;10;0.01
Batata assada;100;g;152;24;5;3;5;0.01
Feijão;100;g;143;26;1;9;5;0.01
Frango;100;g;159;0;3;32;6;0.01
Bife;100;g;122;0;4;21;6;0
Lasanha;300;g;389;36;17;24;15;0.03
Tilápia;113;g;99;0;2;19;15;0.01
Parmegiana;200;g;700;59;39;30;15;0.04
Macarrão;80;g;279;59;1;8;10;0.03
Alface;25;g;5;1;0;0;2;0
Tomate;50;g;9;2;0;1;2;0
Repolho;70;g;31;7;0;1;2;0
Cenoura;100;g;34;8;0;1;2;0
Couve-flor;100;g;22;4;0;1;2;0
Brocolis;100;g;158;55;2;3;2;0
Nozes;100;g;607;21;54;20;2;0
Atum;110;g;197;0;10;24;6;0.04
Sardinha;100;g;147;0;11;21;6;0.04
;Peso;Medida;Calorias;Carbs;Gordura;Proteina;Consumo;Fibras;Umidade
Pizza;250;g;300;35;12;13;0;8;55.39
Hamburguer;400;g;267;11.04;16.01;19.3;0;0;52.37
Coxinha;80;g;283.048;34.52058333;11.836;9.610416667;0;4.970333333;42.21066667
Pastel;400;g;422.11208;48.13273362;22.67033333;8.709599709;0;0.943333333;17.541
Pão de queijo;100;g;363.0779133;34.2415;24.56733333;5.120833333;0;0.558333333;33.736
Batata-frita;100;g;542.7346734;51.22233333;36.615;5.583333333;0;2.455666667;2.697333333
Pipoca;100;g;448.3342618;70.31258333;15.941;9.927083333;0;14.33666667;2.819
Milk-shake;230;ml;118;15.57;5.18;2.68;0;0.7;73.368
Sorvete;60;g;255;20.57;16.98;4.72;0;0.9;57.52
Bolo;100;g;410.0136667;54.71775;18.47233333;6.222916667;0;1.43;19.27633333
Doce de leite;20;g;306.3101302;59.49337324;5.993;5.478293432;0;0;27.5
Chocolate;11;g;539.5866667;59.57666667;30.26666667;7.22;0;2.17;1.256666667
Ovo cozido;40;g;145.70017;0.614916667;9.476333333;13.29375;0;0;75.76566667
Ovo frito;50;g;240.187224;1.193666667;18.59266667;15.61666667;0;0;63.49733333
Misto quente;100;g;241;22.84;10.6;14.17;0;0;74.17
Tapioca;100;g;347.8265563;63.59175;10.90833333;0.089583333;0;0;24.90233333
Queijo;122;g;264.273128;3.240313333;20.18066667;17.41102;0;0;56.12466667
Maça;120;g;62.53181837;16.588;0.246;0.225;0;2.026333333;82.649
Banana;118;g;91.52884783;23.84811594;0.116666667;1.398550725;0;1.946666667;73.79666667
Mamão;150;g;40.15676894;10.43975;0.124333333;0.45625;0;1.042666667;88.583
Abacate;100;g;96.1547087;6.030869565;8.396666667;1.239130435;0;6.313333333;83.78666667
Laranja;90;g;45.70103878;11.53375;0.075333333;1.05625;0;1.782;86.974
Morango;50;g;30.14791739;6.818405797;0.31;0.894927536;0;1.723333333;91.52666667
Leite;200;ml;69.621474;15.67447333;0.099;1.89486;0;0;81.87933333
Café;60;ml;418.6186667;65.75333333;11.94666667;14.7;0;51.22666667;2.93
Suco de laranja;200;ml;39.33609394;9.167416667;0.119333333;0.714583333;0;0.424;89.68066667
Refrigerante;200;ml;33.5142;8.66;0;0;0;0;91.27666667
Arroz;100;g;128.2584857;28.05985;0.227;2.520816667;0;1.561;69.11366667
Batata assada;100;g;51.58847664;11.94375;0;1.164583333;0;1.343333333;86.35966667
Feijão;100;g;76.42408567;13.59103333;0.542333333;4.775;0;8.510333333;80.35063333
Frango;100;g;159.1850072;0;2.483666667;32.03333333;0;0;63.80933333
Bife;100;g;193.6915667;0;4.486666667;35.88333333;0;0;57.53333333
Lasanha;300;g;163.7636667;32.52216667;1.158333333;5.8125;0;1.636333333;59.64633333
Peixe;113;g;131.2083147;0;5.641666667;18.81041667;0;0;76.16
Nhoque;200;g;180.775274;36.78;1.943333333;5.858333333;0;1.78;54.954
Macarrão;80;g;119.5317714;22.52236683;0.889666667;4.934299835;0;0.776666667;71.41233333
Alface;25;g;8.794903237;1.745333333;0.129;0.608333333;0;1.021666667;97.16866667
Tomate;50;g;15.33515652;3.13884058;0.173333333;1.097826087;0;1.173333333;95.12666667
Repolho;70;g;17.1188029;3.859855072;0.143333333;0.876811594;0;1.89;94.72
Cenoura;100;g;29.86177771;6.68675;0.218333333;0.847916667;0;2.629;91.663
Couve-flor;100;g;19.11414061;3.875416667;0.269333333;1.239583333;0;2.130333333;94.33833333
Brocolis;100;g;24.63616311;4.366666667;0.459;2.133333333;0;3.416666667;92.617
Nozes;100;g;620.0600198;18.36386616;59.35966667;13.9708005;0;7.249666667;6.244666667
Atum;110;g;165.9105606;0;5.996666667;26.1875;0;0;64.5
Sardinha;100;g;284.9810049;0;24.04866667;15.93958333;0;0;55.14266667
7 changes: 7 additions & 0 deletions unity-project/Assets/Resources/FoodDBtab.csv.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion unity-project/Assets/Scripts/Body/Weight.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void WeightChange(){

state.basalCalorie = Mathf.RoundToInt(state.activityFactor * (10f * state.currentWeightKg +
6.25f * state.heightCentimeters - 5f * state.ageYears + state.sexFactor));
state.dailyCalorieRealDefficit = state.calorieDifference - state.basalCalorie;
state.dailyCalorieRealDefficit = (int)state.calorieDifference - state.basalCalorie;
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
[CreateAssetMenu(fileName = "Food", menuName = "ScriptableObjects/FoodTypeScriptableObject", order = 1)]
public class FoodTypeScriptableObject : ScriptableObject{
public string food, measure;
public int weight, calorieCost;
public float carbs, protein, fat;
public int weight;
public float calorieCost, carbs, protein, fat;
public int consumingTime;
public float processingLevel;
public GameObject go;
Expand Down
13 changes: 7 additions & 6 deletions unity-project/Assets/Scripts/Foods/Fridge.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@ List<FoodTypeScriptableObject> LoadFoodDatabase(TextAsset dataset){
FoodTypeScriptableObject _f = new FoodTypeScriptableObject();
//get raw data
_f.food = data[0];
_f.weight = int.Parse(data[1]);
_f.weight = int.Parse(data[1], CultureInfo.InvariantCulture);
_f.measure = data[2];
int cals = int.Parse(data[3]);
int carbs = int.Parse(data[4]);
int fats = int.Parse(data[5]);
int proteins = int.Parse(data[6]);
_f.consumingTime = int.Parse(data[7]);
float cals = float.Parse(data[3], CultureInfo.InvariantCulture);
float carbs = float.Parse(data[4], CultureInfo.InvariantCulture);
Debug.Log(data[5]);
float fats = float.Parse(data[5], CultureInfo.InvariantCulture);
float proteins = float.Parse(data[6], CultureInfo.InvariantCulture);
_f.consumingTime = int.Parse(data[7], CultureInfo.InvariantCulture);
_f.processingLevel = float.Parse(data[8], CultureInfo.InvariantCulture);

//data processing
Expand Down
3 changes: 1 addition & 2 deletions unity-project/Assets/Scripts/Foods/Plate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ public void RemoveFromPlate(FoodTypeScriptableObject food){
}

public void EatPlate(){
int calories = 0;
float carbs = 0, protein = 0, fat = 0, processingAverage = 0;
float calories = 0, carbs = 0, protein = 0, fat = 0, processingAverage = 0;

foreach(FoodTypeScriptableObject item in foodPlate){
calories += item.calorieCost;
Expand Down
5 changes: 2 additions & 3 deletions unity-project/Assets/Scripts/Foods/UI/Plate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ public void SelectFood(FoodTypeScriptableObject item){
}

public void PlateNutritionalInfo(){
int calories = 0;
float carbs = 0, proteins = 0, fats = 0;
float calories = 0, carbs = 0, proteins = 0, fats = 0;
foreach(FoodTypeScriptableObject food in GetComponent<Foods.Plate>().FoodPlate){
calories += food.calorieCost;
carbs += food.carbs;
Expand Down Expand Up @@ -102,7 +101,7 @@ void ChangeCurrentFoodQuantity(float weight){
selectedFood.weight = (int)weight;
}

void PizzaGraph(float[] macros, int calories){
void PizzaGraph(float[] macros, float calories){
Foods.UI.Fridge generalUI = GetComponent<Foods.UI.Fridge>();
generalUI.SetChartValues(macros, macroPizzaChart);
totalCalories.text = calories + "kcal";
Expand Down
5 changes: 2 additions & 3 deletions unity-project/Assets/Scripts/SaveSystem/SaveState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ public class SaveState{

public float energy = 1;

public int ageYears = 16, heightCentimeters = 172, calorieDifference = 1100/*caloriesIn - caloriesOut*/,
currentDayExerciseQuantity = 0, dailyCalorieRealDefficit = 0 /*calorieDifference - basal*/, basalCalorie = 0;
public int ageYears = 16, heightCentimeters = 172, currentDayExerciseQuantity = 0, dailyCalorieRealDefficit = 0 /*calorieDifference - basal*/, basalCalorie = 0;

//sexFactor +5 for men and -161 for women
public float activityFactor = 1f, sexFactor = 5f;
Expand All @@ -20,7 +19,7 @@ public class SaveState{
//changing this will change the game difficulty
public float totalHoursSlept = 350, numberOfSleeps = 50, sleepQuality = 0.84f, hoursSinceLastSlept = 16;

public float carbs = 230, fat = 82, protein = 152;
public float calorieDifference = 1100/*caloriesIn - caloriesOut*/,carbs = 230, fat = 82, protein = 152;

public float hydration = 0.5f;

Expand Down

0 comments on commit b1169e2

Please sign in to comment.