예제 #1
0
 internal override async Task AttachEntityAsync(IAttachArgs e)
 {
     if (IsOpen)
     {
         await base.AttachEntityAsync(e);
     }
     else
     {
         e.Seal();
     }
 }
예제 #2
0
        internal override Task AttachEntityAsync(IAttachArgs e)
        {
            if (IsExtended && e.CurrentMove.Entity is PistonEntity)
            {
                e.Result = new PistonTile(TriggerPosition, Direction, false);
            }
            else
            {
                e.Seal();
            }

            return Task.CompletedTask;
        }
예제 #3
0
 internal override async Task AttachEntityAsync(IAttachArgs e)
 {
     if (e.CurrentMove.Entity is PlayerEntity)
     {
         // Players may walk over pins, use default behavior
         await base.AttachEntityAsync(e);
     }
     else if ((e.CurrentMove.Entity as BalloonEntity)?.Color == Color)
     {
         // Balloons that match the pin's color are allowed
         e.Result = Compose(this, e.CurrentMove.Entity);
     }
     else
     {
         // All other entities are rejected
         e.Seal();
     }
 }
예제 #4
0
        internal override async Task AttachEntityAsync(IAttachArgs e)
        {
            var inDirection = e.CurrentMove.Offset;
            var outDirection = _outDirections.TryGetValue(new Tuple<Point, Point>(Orientation, inDirection));

            if (outDirection.IsDirection)
            {
                if (Entity != Entity.None)
                    await Entity.DetachAsync(e.CreateEntityDetachArgs(this, outDirection));

                if (!e.IsSealed)
                    e.Result = Compose(this, e.CurrentMove.Entity);
            }
            else
            {
                // The entity tries to move across a wall side of the corner
                e.Seal();
            }
        }
예제 #5
0
 internal override Task AttachEntityAsync(IAttachArgs e)
 {
     e.Seal();
     return Task.CompletedTask;
 }