Exemple #1
0
 // Update is called once per frame
 void Update()
 {
     if (isLoadingLevel && !sceneUnloading)
     {
         if (!levelLoadingComplete)
         {
             for (int i = 0; i < Level.Columns; i++)
             {
                 LoadNext();
                 if (X >= Level.Columns - 1)
                 {
                     X = 0;
                     Y++;
                     if (Y >= Level.Rows)
                     {
                         Y = 0;
                         if (CurrentLoadingLayer == BlockLayers.Integral)
                         {
                             CurrentLoadingLayer = BlockLayers.Decoration;
                         }
                         else
                         {
                             levelLoadingComplete = true;
                         }
                     }
                 }
                 else
                 {
                     X++;
                 }
             }
         }
         else if (!IsDone)
         {
             IsDone = true;
             OnLevelLoaded();
         }
     }
     if (!showingTitleCard && IsDone && canShowTitleCard)
     {
         showingTitleCard = true;
         canShowTitleCard = false;
         titleCardTimer   = 0f;
         MessagePromptBehavior.ShowMessage(Level.Name);
     }
     if (showingTitleCard && titleCardTimer > 5.0f)
     {
         showingTitleCard = false;
         MessagePromptBehavior.HideMessage();
     }
     else if (showingTitleCard)
     {
         titleCardTimer += Time.deltaTime;
     }
     if (IsDone)
     {
         //Check if all pickups are picked up
         if (CurrentWorld.AllPattiesCollected)
         {
             SignalLevelCompleted(true);
         }
         CurrentWorld.UpdateTimeRemaining((int)levelTime.TotalSeconds);
         levelTime -= TimeSpan.FromSeconds(Time.deltaTime);
         if (levelTime < TimeSpan.Zero)
         {
             Player.KillAllPlayers();
         }
     }
 }