// Update is called once per frame void Update() { timeElapsed += Time.deltaTime; //Timer if (counter >= agentCalls) //Every X smallUpdates { StaticValues.weekNo++; bigUpdateTrigger(); //Call all tiles bigUpdates counter = 0; //Reset counter if (StaticValues.cityMoney < 0) //If the player is bankrupt { StaticValues.winStrikes = 0; //Reset winning counter if (StaticValues.loseStrikes == 3) { levelChanges.LoadLevelNumber(2); //Game over } else { StaticValues.loseStrikes++; //Closer to game over soundManager.PlayingSound(10, 0.75f); //Warning } } else if (StaticValues.cityMoney > StaticValues.goalMoney) { StaticValues.loseStrikes = 0; if (StaticValues.winStrikes == 3) //Reached target for 3 months? { levelChanges.LoadLevelNumber(1); //Level Complete! } else { StaticValues.winStrikes++; soundManager.PlayingSound(5, 0.75f); } } else //Reset both win and lose { StaticValues.winStrikes = 0; StaticValues.loseStrikes = 0; } } if (timeElapsed >= timeSmallInterval) //Call smallupdate if enough time has elapsed { smallUpdateTrigger(counter); //Call all subscribed methods counter++; //count the number of small updates so bigupdate can be triggered timeElapsed = 0; //reset timer StaticValues.AssignIncomingOutgoing(); //Complete incoming outgoing lists } }
/// <summary> /// Things to complete first time only /// </summary> public virtual void Initialise() { soundManager.PlayingSound(1, 0.05f); Recheck(); foreach (GameObject g in neighbourList) { if (g != null) { g.GetComponent <CityTile>().Recheck(); //Call recheck on all neighbours to update tile neighbours/connections } } StartCoroutine(RoadFrameWait());//Needs a delay to properly show road tiles connecting }