public void SetObjectData(ISerializationData dataHolder, ISerializationContext context) { if (emotionPool == null) { emotionPool = new Dictionary <string, ActiveEmotion>(); } else { emotionPool.Clear(); } if (mood == null) { mood = new Mood(); } this.appraisalConfiguration = dataHolder.GetValue <EmotionalAppraisalConfiguration>("AppraisalConfiguration"); if (this.appraisalConfiguration == null) { this.appraisalConfiguration = new EmotionalAppraisalConfiguration(); } mood.SetMoodValue(dataHolder.GetValue <float>("Mood"), this.appraisalConfiguration); mood.SetTick0Value(dataHolder.GetValue <ulong>("initialTick")); context.PushContext(); { context.Context = (ulong)0; //Tick var emotions = dataHolder.GetValue <ActiveEmotion[]>("EmotionalPool"); foreach (var emotion in emotions) { emotionPool.Add(calculateHashString(emotion), emotion); } } context.PopContext(); }