I want to start with a metabolism semi-simulator. In theory it doesn’t sound that complicated, basically, you have calories, macronutrients (carbs, fats, and protein) and possibly micronutrients (vitamins, minerals etc.), simply in form of numbers that go into metabolism “class?”, which “metabolizes” all of it according to as scientifically accurate information as possible I can dig off of the internet. My idea is to make a game in which you have a cartoonish simple character in the middle of the screen, representing body fat percentage and anything that is appropriate. The second part would be food, that basically are items that you mouse drag onto the character to make him consume it. Of course, the food carries all the nutrients and calories that go into aforementioned metabolism system.
Since my former fields where visual and artistic with minimal programming exposure, I am asking for advice or tips on how should I go into this? Should I switch to visual programming software?
Thanks very much to anyone that can help!
That’s my first prototype:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
public class metabolism : MonoBehaviour {
public float BMR = 1600f;
public float BMRinSec = 0.185f;
public float CalIntakeInSec = 0.185f;
public float bodyFat = 1f;
public float glycogenStorage = 0f;
public float calorieStorage = 1600f;
public float cancerRisk = 0.2f;
public float timeScale = 1f;
public float spacingGUI = 2f;
public float calorieStorageUpdated;
public float timeSpeed = 1f;
public float timer;
public decimal counter;
// Use this for initialization
void Start () {
}
void calIntakeUpdate() {
calorieStorage += CalIntakeInSec;
}
void calIntakeStop() {
CalIntakeInSec = 0f;
}
// Update is called once per frame
void Update () {
Time.timeScale = timeSpeed;
timer += Time.deltaTime;
if (timer >= 1) {
counter++;
timer = 0f;
calorieStorage -= BMRinSec;
if (calorieStorage >= BMR) {
calIntakeStop ();
}
calIntakeUpdate ();
if (calorieStorage <= 0) {
bodyFat -= 0.01f;
}
else if (calorieStorage >= BMR && glycogenStorage >= 500f) {
bodyFat += CalIntakeInSec;
}
else if (calorieStorage >= BMR) {
glycogenStorage += CalIntakeInSec;
}
}
transform.localScale = new Vector3 (bodyFat, bodyFat, 0);
}
void OnGUI() {
GUI.Label (new Rect (10, 10 * spacingGUI, 100, 20), "BMR: " + BMR);
GUI.Label (new Rect (10, 30 * spacingGUI, 100, 20), calorieStorage.ToString());
GUI.Label (new Rect (10, 60 * spacingGUI, 100, 20), "sec: " + counter);
GUI.Label (new Rect (10, 90 * spacingGUI, 100, 20), "glcgn: " + glycogenStorage);
}
}