Home Game Development knowledge construction – Should the state object be outlined contained in the precise object? For Save/Load objective

knowledge construction – Should the state object be outlined contained in the precise object? For Save/Load objective

0
knowledge construction – Should the state object be outlined contained in the precise object? For Save/Load objective

[ad_1]

I’ve a category Furniture with a subclass of FurnitureState the place all of the “reside” knowledge can be saved. During gameplay when the furnishings can be turned off or relocated (Player motion) it’ll change the fields of this state class.

The concept is that i can simply serialize all of the states through the save operation by simply iterating over all furnitures, objects, enemies.

public class Furniture
{
    [System.Serializable]
    public class FurnitureState
    {
        public string furnitureType;
        public int x;
        public int y;
        public int enabled;
    }

    public FurnitureState state;
}

Is this an excellent strategy or ought to i hold the state lessons in separate recordsdata with all different states for participant, objects, enemies?

Is it good apply to have the state class to be serializable or ought to i take advantage of one other class which is able to extract the properties that sould be saved/loaded?

[ad_2]

LEAVE A REPLY

Please enter your comment!
Please enter your name here