void BuildAndSendSpeedMessage() { List <SpeedModel> a = googleApiHandler.GetSpeedModels(); int inactiveHours = 9 - a.Count; int topSpeed = 0; for (int i = 0; i < a.Count; i++) { if (a[i].speeds[1] > topSpeed) { topSpeed = (int)a[i].speeds[1]; } } string speedMessage = ""; if (inactiveHours == 9) { speedMessage += "You didn't move at all yesterday! You'll be looking at some pretty hight Helath care costs today... The cost of health care buildings is increase by 1.4x"; } else if (inactiveHours < 9 && inactiveHours > 5) { speedMessage += "You should try to move more. You seem to have been sitting for " + inactiveHours + " hours yesterday The cost of health care buildings will be increased by 1.1x"; } else if (inactiveHours <= 5) { speedMessage += "Wow! An active day yesterday. You only sat still for about " + inactiveHours + " hours yesterday. The cost of health care buildings are now 0.75 of the original cost!"; } speedMessage += "Your top speed yesterday was " + topSpeed + " m/s"; if (topSpeed < 1) { speedMessage += ". You are kind of a slow walker."; } else if (topSpeed >= 1 && topSpeed < 2) { speedMessage += " I guess you were not in a hurry?"; } else if (topSpeed >= 2 && topSpeed < 4) { speedMessage += " That's a good pace!"; } else if (topSpeed >= 4) { speedMessage += " Looks like you went for a run... Or biking... Or maybe you were sitting still on a slow moving train. I can't know everything, I'm not psycic"; } MessageManager.instance.QueueMessage(new InfoMessage("The intrusive doctor", speedMessage)); }
/// <summary> /// Bonuses from active hours. Inactive hours is every hour that has no speed data between 09 and 18 /// </summary> /// <param name="nrOfInactiveHours"></param> public void SetConstructionBonusesFromActiveHours() { List <SpeedModel> speedModels = apiHandler.GetSpeedModels(); //Gets speeds for 9 hours yesterday. If every hour has been active speedModels.Length should be 9 int nrOfInactiveHours = 9 - speedModels.Count; if (nrOfInactiveHours == 9) { healthCareCostBonus = 1.4f; } else if (nrOfInactiveHours < 9 && nrOfInactiveHours >= 5) { healthCareCostBonus = 1.1f; } else { healthCareCostBonus = 0.75f; } }