I have a class Furniture with a subclass of FurnitureState where all the "live" data will be stored. During gameplay when the furniture will be turned off or relocated (Player action) it will change the fields of this state class.
The idea is that i can easily serialize all the states during the save operation by just iterating over all furnitures, items, 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 a good approach or should i keep the state classes in separate files with all other states for player, items, enemies?
Is it good practice to have the state class to be serializable or should i use another class which will extract the properties that sould be saved/loaded?