Exemplo n.º 1
0
        public override ActivityStep ResolveStep(GameEntity entity)
        {
            bool stillHoldingEatenEntity = entity.hasEntityHolder &&
                                           entity.entityHolder.EntityHeld != Guid.Empty && // eaten item could have been destroyed, so we don't call _itemToEat.id.Id too eagerly
                                           entity.entityHolder.EntityHeld == _itemToEat.id.Id;

            if (!stillHoldingEatenEntity)
            {
                return(Fail(entity));
            }

            bool stillSatiating = entity.hasEdible && entity.edible.Satiety > 0;

            if (!stillSatiating)
            {
                return(Succeed(entity));
            }

            IGameAction eatPartAction = _actionFactory.CreateEatItemAction(_itemToEat, entity);

            return(new ActivityStep
            {
                State = ActivityState.InProgress,
                GameAction = eatPartAction
            });
        }