示例#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;
 }