Beispiel #1
0
 internal override Task OnEntityMoveTransactionCompletedAsync(IMovesCompletedArgs e)
 {
     if (Entity != Entity.None && Sensitivity.Includes(Entity.GetType()))
     {
         e.Result = Compose(new ButtonTile(true, Sensitivity), Entity);
         if (!IsOn) e.Emit(new ButtonToggleEvent(true));
     }
     else
     {
         e.Result = Compose(new ButtonTile(false, Sensitivity), Entity);
         if (IsOn) e.Emit(new ButtonToggleEvent(false));
     }
     return Task.CompletedTask;
 }
Beispiel #2
0
        internal override Task OnEntityMoveTransactionCompletedAsync(IMovesCompletedArgs e)
        {
            if ((Entity as BalloonEntity)?.Color == Color)
            {
                // Destroy the balloon
                e.Result = new PinTile(Color);
                e.Emit(new BalloonPopEvent(Color));
            }
            else
            {
                // Otherwise, nothing changes
                e.Result = this;
            }

            return Task.CompletedTask;
        }
Beispiel #3
0
        internal override Task OnEntityMoveTransactionCompletedAsync(IMovesCompletedArgs e)
        {
            var balloon = Entity as BalloonEntity;

            if (balloon != null)
            {
                // Consume the ink to color the balloon
                e.Result = Compose(PathTile.Default, new BalloonEntity(Color));

                if (Color != balloon.Color)
                    e.Emit(new InkTileConsumeEvent(balloon.Color, Color));
            }
            else
            {
                // Otherwise, nothing changes
                e.Result = this;
            }

            return Task.CompletedTask;
        }
Beispiel #4
0
        internal override async Task OnEntityMoveTransactionCompletedAsync(IMovesCompletedArgs e)
        {
            // Check trigger state
            var trigger = (await e.GetAsync(TriggerPosition)).Tile as ITrigger;

            if (trigger?.IsOn ?? false)
            {
                e.Result = Compose(new GateTile(TriggerPosition, true), Entity);
                if (!IsOpen) e.Emit(new GateTileOpenCloseEvent(true));
            }
            else
            {
                if (Entity == Entity.None)
                {
                    e.Result = new GateTile(TriggerPosition, false);
                    if (IsOpen) e.Emit(new GateTileOpenCloseEvent(false));
                }
                else
                {
                    e.Result = Compose(new GateTile(TriggerPosition, true), Entity);
                    if (!IsOpen) e.Emit(new GateTileOpenCloseEvent(true));
                }
            }
        }