public void ChooseAction() { Visits++; agent.speed = origSpd; GetComponent <MeshRenderer>().material.color = Color.white; finished = false; startPos = transform.position; float[] weight = new float[] { GameManager.IsDepartmentFunctional(Departments.Cashier) ? actionWeight[0] : 0, GameManager.IsDepartmentFunctional(Departments.CustService) ? actionWeight[1] : 0, actionWeight[2] }; if (MathRand.WeightedPick(weight) == 0) { GameDemand = (GameType)MarketManager.GetDemands(); StartCoroutine(GoShopping()); //Shopping } else if (MathRand.WeightedPick(weight) == 1) { StartCoroutine(GoWander()); //Wander } else if (MathRand.WeightedPick(weight) == 2 && GameManager.IsDepartmentFunctional(Departments.CustService)) { StartCoroutine(GoComplain()); //Complain } else { ChooseAction(); } }