public Entity AddMood(Assets.Sources.GameLogic.Mood.Mood newMood) { var component = _moodComponentPool.Count > 0 ? _moodComponentPool.Pop() : new Assets.Sources.GameLogic.Mood.MoodComponent(); component.Mood = newMood; return(AddComponent(ComponentIds.Mood, component)); }
public Entity ReplaceMood(Assets.Sources.GameLogic.Mood.Mood newMood) { var previousComponent = hasMood ? mood : null; var component = _moodComponentPool.Count > 0 ? _moodComponentPool.Pop() : new Assets.Sources.GameLogic.Mood.MoodComponent(); component.Mood = newMood; ReplaceComponent(ComponentIds.Mood, component); if (previousComponent != null) { _moodComponentPool.Push(previousComponent); } return(this); }