// When the GO button is pressed, determine which action is selected and go from there. // This only runs once. Need to update it to run for each Farmer. public void TriggerAction() { switch (actionDropdown.value) { case 0: TriggerHarvest(); Rabbits.Breed(); Rabbits.Feed(); GlobalVars.currentTurn += 1; break; case 1: Debug.Log("Plant stub"); break; case 2: Debug.Log("Gather Seed stub"); break; case 3: Debug.Log("Inspect stub"); break; default: Debug.Log("No action detected in the dropdown."); break; } }
static void Main(string[] args) { Rabbit rabbit = new Rabbit() { Name = "pesho", Available = true, Spices = "gogo" }; Rabbit rabbit2 = new Rabbit() { Name = "Gosho", Available = false, Spices = "stop" }; Rabbit rabbit3 = new Rabbit() { Name = "Krasi", Available = true, Spices = "gogo" }; Rabbits rabbits = new Rabbits(); rabbits.Add(rabbit); rabbits.Add(rabbit2); rabbits.Add(rabbit3); foreach (var rab in rabbits) { Console.WriteLine(rab); } var selected = rabbits.Where(x => x.Spices == "gogo").Select(x => { x.Available = false; return(x); }); foreach (var el in selected) { Console.WriteLine(el); } }
static void Main(string[] args) { var startRabbitPairs = 4; var month = 0; var cagePrSquareMeter = 4; var maxSquareMeters = 2000; var maxRabbitPairs = cagePrSquareMeter * maxSquareMeters; var r = new Rabbits(month, startRabbitPairs); //Console.WriteLine($"Total months to fill the farm: {months}"); while (r.Rabbitpairs <= maxRabbitPairs) { month++; } }