MoodSwingGame.MSMap.Update C# (CSharp) Method

Update() public method

public Update ( GameTime gameTime ) : void
gameTime Microsoft.Xna.Framework.GameTime
return void
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);
            List<Vector2> toTransform = new List<Vector2>();
            foreach (MS3DTile tile in mapArray)
            {
                tile.Update(gameTime);
                if (tile is MSChangeableBuilding && (tile as MSChangeableBuilding).State == MSChangeableBuildingState.DONE)
                {
                    if ((tile as MSChangeableBuilding).FutureSelf is MSVolunteerCenter)
                        MSUnitHandler.GetInstance().IsLeaderBusy = false;
                    toTransform.Add(tile.TileCoordinate);
                }
            }
            foreach (Vector2 coord in toTransform)
            {
                if ((mapArray[(int)coord.X, (int)coord.Y] as MSChangeableBuilding).FutureSelf is MSVolunteerCenter)
                    MSResourceManager.GetInstance().VolunteerCapacity += MSResourceManager.VOLUNTEER_CENTER_GAIN;
                mapArray[(int)coord.X, (int)coord.Y] =
                    (mapArray[(int)coord.X, (int)coord.Y] as MSChangeableBuilding).FutureSelf;
                MS3DTile tile = mapArray[(int)coord.X, (int)coord.Y];
                if (tile is MSTower)
                {
                    MSTowerStats stats = (tile as MSTower).Stats;
                    if(stats is MSUltiBuildingStat)
                    {
                        MSMoodManager.GetInstance().NumUltiBuilt++;
                        if(stats is MSAntiretroviralCenterStats || stats is MSBedNetsCenterStats)
                        {
                            MSMoodManager.GetInstance().HivUltiBuilt = true;
                            MSUnitHandler.GetInstance().SetMobEnabled(MSMilleniumDevelopmentGoal.HIV_AIDS, false);
                        }
                        else if (stats is MSApartmentStats || stats is MSEmploymentCenterStats || stats is MSTechnoFarmhouseStats)
                        {
                            MSMoodManager.GetInstance().PovertyUltiBuilt = true;
                            MSUnitHandler.GetInstance().SetMobEnabled(MSMilleniumDevelopmentGoal.POVERTY, false);
                        }
                        else if (stats is MSChildrensLibraryStats || stats is MSSuppliesDonationCenterStats || stats is MSEFASchoolStats)
                        {
                            MSMoodManager.GetInstance().EducationUltiBuilt = true;
                            MSUnitHandler.GetInstance().SetMobEnabled(MSMilleniumDevelopmentGoal.EDUCATION, false);
                        }
                        else if (stats is MSFistulaTreatmentCenterStats || stats is MSMaternalCareCenterStats)
                        {
                            MSMoodManager.GetInstance().MaternalUltiBuilt = true;
                            MSUnitHandler.GetInstance().SetMobEnabled(MSMilleniumDevelopmentGoal.MATERNAL_HEALTH, false);
                        }
                        else if (stats is MSImmunizationOutreachStats || stats is MSVaccinationCenterStats)
                        {
                            MSMoodManager.GetInstance().ChildUltiBuilt = true;
                            MSUnitHandler.GetInstance().SetMobEnabled(MSMilleniumDevelopmentGoal.CHILD_HEALTH, false);
                        }
                        else if (stats is MSWomenPoliticiansCenterStats || stats is MSWomensUniversityStats || stats is MSWhiteScreensCenterStats)
                        {
                            MSMoodManager.GetInstance().GenderUltiBuilt = true;
                            MSUnitHandler.GetInstance().SetMobEnabled(MSMilleniumDevelopmentGoal.GENDER_EQUALITY, false);
                        }
                        else if (stats is MSTrashToCashCenterStats || stats is MSWaterTreatmentPlantStats)
                        {
                            MSMoodManager.GetInstance().EnvironmentUltiBuilt = true;
                            MSUnitHandler.GetInstance().SetMobEnabled(MSMilleniumDevelopmentGoal.ENVIRONMENT, false);
                        }
                        else if (stats is MSWorldWithoutBoundariesStats)
                        {
                            MSMoodManager.GetInstance().GlobalUltiBuilt = true;
                            MSUnitHandler.GetInstance().SetMobEnabled(MSMilleniumDevelopmentGoal.GLOBAL_PARTNERSHIP, false);
                        }
                    }
                }
            }
        }