Is it pretty easy to add equations percentages to game

I am looking at making a game that use simple economics like lemonade tycoon used. Were you buy your supplies have recipes and the weather effect buying patterns ect…

Would there a turorial on this or a guide maybe?

While I don’t think that there are any tutorials specifically focused on this type of gameplay, I believe the mechanics wouldn’t be too hard to flesh out. I have only played Lemonade Tycoon once or twice, and I am still pretty new to Unity and Game Programming altogether, I will show you a simple example of a “stripped down” system. Remember, this is probably not the most efficient or effective way to accomplish this, but I wrote this code to give you a bit of an idea.

// Variables for total recipe items in inventory
var totalLemons = 100; 
var totalSugar = 100; 
var totalIce = 100;

//Variables for recipe items used to make a cup.
var requiredLemons = 5;
var requiredSugar = 8;
var requiredIce = 3;

//Variables to hold total cash and cash per cup.
var totalCash;
var cashPerCup = 1; //One cup costs a dollar

//Array to hold weather information.
var weather = new Array ();
weather[0] = "Sunny";
weather[1] = "Rainy";
weather[2] = "Snowy";
weather[3] = "Mild";

var publicity = 10; // How well known the player is in the current area.
var totalHours = 24; //Every update will cause an hour to pass.
var currentHour = 1; //The hour we are currently on for this day.


function Start () {
	var currentWeather = weather[Random.Range(0,3)]; // The current weather for the day;

function Update () {
	if (currentHour <= totalHours) { //If the day is not over...
	//Generates the total number of customers for the hour, between 0 and publicity.
	var totalCustomers = Random.Range(0, publicity);
	//Loops through and Generates every Customer.
	for (var i=0; i < totalCustomers; i++) {
        GenerateCustomer(); 
        } 	
        currentHour++;	
	}
	
function BuyCup () {
	if (totalLemons > required Lemons  totalSugar > requiredSugar  totalIce > requiredIce) {
	totalLemons -= requiredLemons;
	totalSugar -= requiredSugar;
	totalIce -= requiredIce;
	totalCash += cashPerCup;
	}
	
// This function to be used to randomly generate stats for the current customer.
// As written, it only checks the customers chance to buy based on weather and a bit of randomness.
function GenerateCustomer () {
	var preferedWeather = weather[Random.Range(0,3)];
	var chanceToWalk = Random.Range(1,10); //The customers chance to walk away.
	var chanceToBuy = Random.Range(1,10); //The customers chance to actually buy a cup.
	if (preferedWeather == currentWeather) {
		chanceToBuy += 2; //If the customer prefers this weather, increase his chance to buy.
	}
	if (chanceToBuy > chanceToWalk) {
		BuyCup();
	}
}

Unity experts feel free to chime in with better suggestions :wink: