Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

Question Leaving game while scoring

Discussion in 'Scripting' started by Boolable, Jun 15, 2020.

  1. Boolable

    Boolable

    Joined:
    Jun 28, 2015
    Posts:
    20
    Hi,

    I've made a mobile game using a grid system.
    In this game, you have to bind and destroy items on the grid. When you destroy bound items, there is an animated explosion for each item, one after the other (0.2 seconds between every item). So if you have 10 bound items, the total destruction time will be 2 seconds. Every time a item explode, it gives an amount of score (depending on the group size).
    In parallel to this, I've made a saving system which loops and serialize all items on the grid when the user leave the game.
    My problem is, when the user leave the game while the bound items are being destroyed, it saves the items waiting to be deleted (the ones in the group that are not currently been destroyed due to the 0.2 seconds delay).

    What is the good thing to do when the user leave the game?
    1-Force the bound items to destroy themselves instantly in the current frame (without animation) then save the game.
    2-Store the items status (like "destruction pending") to continue the destruction once the game is resumed.
    3-Rework all the game system to use a matrix system, and not calculate the score and game progress on the graphical elements but on the matrix.

    In a more common way, is it a good practice to develop the gameplay based on GameObject or is it better to work with a matrix?

    Thank you for your help,

    Ben
     
  2. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    1,751
    Without knowing specific details of your implementation, I would probably be inclined to investigate option 1 as being likely to be the easiest approach.
     
    Yoreki likes this.
  3. Boolable

    Boolable

    Joined:
    Jun 28, 2015
    Posts:
    20
    Thank you @Munchy2007. I ended up doing option 1. I will consider using method 3 for my next games.
     
    Munchy2007 likes this.