public void SetObjectState(SerializationState state) { foreach (var componentName in state.Fields) { var componentSerializationState = state.GetState(componentName.Key); var component = componentSerializationState.Instantiate <Component>(Hedgemen.RegisteredAssemblies, false); InternalAddComponent(component); component.ReadFromSerializationState(componentSerializationState); } }
public override void SetObjectState(SerializationState state) { Strength = state.GetValue("strength", 10); Dexterity = state.GetValue("dexterity", 10); Constitution = state.GetValue("constitution", 10); Intelligence = state.GetValue("intelligence", 10); Wisdom = state.GetValue("wisdom", 10); Charisma = state.GetValue("charisma", 10); Class = state.GetState("class")?.Instantiate <CharacterClass>(); }