Example #1
0
        public Entity AddGameEventState(Assets.Sources.GameLogic.Components.EventState newEventState)
        {
            var component = _gameEventStateComponentPool.Count > 0 ? _gameEventStateComponentPool.Pop() : new Assets.Sources.GameLogic.Components.GameEventStateComponent();

            component.EventState = newEventState;
            return(AddComponent(ComponentIds.GameEventState, component));
        }
Example #2
0
        public Entity ReplaceGameEventState(Assets.Sources.GameLogic.Components.EventState newEventState)
        {
            var previousComponent = hasGameEventState ? gameEventState : null;
            var component         = _gameEventStateComponentPool.Count > 0 ? _gameEventStateComponentPool.Pop() : new Assets.Sources.GameLogic.Components.GameEventStateComponent();

            component.EventState = newEventState;
            ReplaceComponent(ComponentIds.GameEventState, component);
            if (previousComponent != null)
            {
                _gameEventStateComponentPool.Push(previousComponent);
            }
            return(this);
        }