Exemplo n.º 1
0
        public override IEnumerable <IActionEffect> Execute()
        {
            Position activeActorPositionBefore    = Entity.position.Position;
            Position displacedActorPositionBefore = DisplacedEntity.position.Position;

            Entity.ReplacePosition(displacedActorPositionBefore);
            DisplacedEntity.ReplacePosition(activeActorPositionBefore);

            yield return(ActionEffectFactory.CreateMoveEffect(Entity, activeActorPositionBefore));

            yield return(ActionEffectFactory.CreateMoveEffect(Entity, displacedActorPositionBefore));
        }
Exemplo n.º 2
0
        public override IEnumerable <IActionEffect> Execute()
        {
            Position previousPosition = Entity.position.Position;
            Position newPosition      = previousPosition + Direction;

            if (_grid.IsWalkable(newPosition))
            {
                IActionEffect effect = ActionEffectFactory.CreateMoveEffect(Entity, previousPosition);
                Entity.ReplacePosition(newPosition);
                yield return(effect);
            }
            else
            {
                IActionEffect effect = ActionEffectFactory.CreateBumpEffect(Entity, newPosition);
                yield return(effect);
            }
        }