Ejemplo n.º 1
0
        public override Moves?CausesSlip(Block moving, Block standing)
        {
            if (moving.Chip && HasBoots(Boots.ICESKATES))
            {
                return(null);
            }
            else
            {
                Moves m     = standing.Facing;
                Moves?force = null;
                switch (moving.Facing)
                {
                case Moves.UP:
                    force = m == Moves.UP ? Moves.RIGHT : Moves.LEFT;
                    break;

                case Moves.DOWN:
                    force = m == Moves.DOWN ? Moves.LEFT : Moves.RIGHT;
                    break;

                case Moves.LEFT:
                    force = m == Moves.UP ? Moves.DOWN : Moves.UP;
                    break;

                case Moves.RIGHT:
                    force = m == Moves.LEFT ? Moves.DOWN : Moves.UP;
                    break;
                }

                return(force);
            }
        }
Ejemplo n.º 2
0
        public virtual void Tick(Block caller)
        {
            Moves m = caller.Facing;

            switch (m)
            {
            case Moves.UP:
                if (Move(caller, Moves.UP) || Move(caller, Moves.RIGHT) || Move(caller, Moves.LEFT) || Move(caller, Moves.DOWN))
                {
                }

                break;

            case Moves.RIGHT:
                if (Move(caller, Moves.RIGHT) || Move(caller, Moves.DOWN) || Move(caller, Moves.UP) || Move(caller, Moves.LEFT))
                {
                }

                break;

            case Moves.LEFT:
                if (Move(caller, Moves.LEFT) || Move(caller, Moves.UP) || Move(caller, Moves.DOWN) || Move(caller, Moves.RIGHT))
                {
                }

                break;

            case Moves.DOWN:
                if (Move(caller, Moves.DOWN) || Move(caller, Moves.LEFT) || Move(caller, Moves.RIGHT) || Move(caller, Moves.UP))
                {
                }

                break;
            }
        }
        public virtual void Tick(Block caller)
        {
            Moves m = caller.Facing;

            switch (m)
            {
            case Moves.UP:
                if (!caller.Move(Moves.LEFT))
                {
                    if (!caller.Move(Moves.UP))
                    {
                        if (!caller.Move(Moves.RIGHT))
                        {
                            caller.Move(Moves.DOWN);
                        }
                    }
                }
                break;

            case Moves.LEFT:
                if (!caller.Move(Moves.DOWN))
                {
                    if (!caller.Move(Moves.LEFT))
                    {
                        if (!caller.Move(Moves.UP))
                        {
                            caller.Move(Moves.RIGHT);
                        }
                    }
                }
                break;

            case Moves.DOWN:
                if (!caller.Move(Moves.RIGHT))
                {
                    if (!caller.Move(Moves.DOWN))
                    {
                        if (!caller.Move(Moves.LEFT))
                        {
                            caller.Move(Moves.UP);
                        }
                    }
                }
                break;

            case Moves.RIGHT:
                if (!caller.Move(Moves.UP))
                {
                    if (!caller.Move(Moves.RIGHT))
                    {
                        if (!caller.Move(Moves.DOWN))
                        {
                            caller.Move(Moves.LEFT);
                        }
                    }
                }
                break;
            }
        }
Ejemplo n.º 4
0
 public override void React(Block moving, Block standing)
 {
     Move.Moves facing = moving.Facing;
     moving.Move(Move.Reverse(facing));
     moving.Facing = facing;
     standing.Replace(CreateBlock(Block.Type.WALL));
     Sound().Play(Shared.Sound.ChipHum);
 }
Ejemplo n.º 5
0
 public virtual void Put(Block b, Moves m)
 {
     map[b] = m;
     if (!order.Contains(b))
     {
         order.Add(b);
     }
 }
Ejemplo n.º 6
0
 public virtual void AddToSlipList(Block b, Moves m)
 {
     if (b.Chip)
     {
         chipForced = new BlockMove(b, m);
     }
     else
     {
         slipList.Put(b, m);
     }
 }
        private bool Move(Block caller, Moves m)
        {
            Moves before = caller.Facing;
            bool  ret    = caller.Move(m);

            if (!ret)
            {
                caller.Facing = before;
            }

            return(ret);
        }
Ejemplo n.º 8
0
 public Block(Type t, Moves m, IBlockTickBehavior btb, BlockReaction from, BlockReaction to, IButtonBehavior bb, CloneBehavior cb, ITrapReleaseBehavior trb, IDestroyBehavior db)
 {
     Trapped             = false;
     type                = t;
     facing              = m;
     tickBehavior        = btb;
     this.@from          = from;
     this.to             = to;
     buttonBehavior      = bb;
     cloneBehavior       = cb;
     trapReleaseBehavior = trb;
     destroyBehavior     = db;
 }
Ejemplo n.º 9
0
        public override bool canMove(Block moving, Block standing)
        {
            if (moving.Chip)
            {
                Moves facingBefore = standing.Facing;
                standing.Facing = moving.Facing;

                // We want to exclude ice corners here
                bool isOnIce = standing.IsOn(Block.Type.ICE);
                bool ret     = (isOnIce || standing.CanMoveFrom()) && standing.CanMoveTo(moving.Facing);
                standing.Facing = facingBefore;
                return(ret);
            }

            return(false);
        }
        public virtual void Tick(Block caller)
        {
            if (caller.OnCloner)
            {
                return;
            }

            Moves moves = caller.Facing;

            if (!caller.Move(moves))
            {
                moves         = Move.Reverse(moves);
                caller.Facing = moves;
                caller.Move(moves);
            }
        }
Ejemplo n.º 11
0
        private void ForceMove(Block b, Moves m)
        {
            if (!level.MoveBlock(b, m, !b.OnTrap, false))
            {
                if (!b.OnTrap)
                {
                    // Bounce
                    b.Facing = Move.Reverse(m);
                    if (!b.Chip)
                    {
                        RemoveFromSlipList(b);
                    }

                    b.Forced = false;
                    level.MoveBlock(b, null, true, true);
                }
            }
        }
Ejemplo n.º 12
0
 public static void PrintFinalOrders(Move.Moves orders)
 {
     foreach (var order in orders.Orders)
     {
         if (order is BotOrderDeploy)
         {
             AILog.Log("FINAL DEPLOY: ", ((BotOrderDeploy)order).Armies + " TO " + ((BotOrderDeploy)order).Territory.Details.Name + "(" + ((BotOrderDeploy)order).Territory.Bonuses[0].Details.Name + ")");
         }
         else if (order is BotOrderAttackTransfer)
         {
             AILog.Log("FINAL ATTACK/TRANSFER: ", ((BotOrderAttackTransfer)order).Armies.NumArmies + " FROM " + ((BotOrderAttackTransfer)order).From.Details.Name + "(" + ((BotOrderAttackTransfer)order).From.Bonuses[0].Details.Name + ")" + " TO " + ((BotOrderAttackTransfer)order).To.Details.Name + "(" + ((BotOrderAttackTransfer)order).From.Bonuses[0].Details.Name + ")");
         }
         else
         {
             AILog.Log("FINAL ATTACK/TRANSFERL: ", "Unexpected Move");
         }
     }
 }
Ejemplo n.º 13
0
        public Block Get(Type type, Moves direction)
        {
            IDictionary <Moves, Block> movesBlocks;

            loadedBlocks.TryGetValue(type, out movesBlocks);

            if (movesBlocks == null)
            {
                movesBlocks        = new Dictionary <Moves, Block>();
                loadedBlocks[type] = movesBlocks;
            }

            BlockImageFactory.Instance.GetImage(type, direction, false);

            Block b = CreateBlock(type, direction);

            movesBlocks[direction] = b;
            return(b);
        }
Ejemplo n.º 14
0
        public override bool canMove(Block moving, Block standing)
        {
            Moves m = standing.Facing;

            switch (moving.Facing)
            {
            case Moves.UP:
                return(m == Moves.UP || m == Moves.LEFT);

            case Moves.DOWN:
                return(m == Moves.DOWN || m == Moves.RIGHT);

            case Moves.LEFT:
                return(m == Moves.UP || m == Moves.RIGHT);

            case Moves.RIGHT:
                return(m == Moves.LEFT || m == Moves.DOWN);
            }
            return(false);
        }
        public virtual CanvasBitmap GetImage(Type type, Moves moves, bool overlay)
        {
            var images = overlay ? loadedImagesOverlay : loadedImages;

            IDictionary <Moves, CanvasBitmap> moveImages;

            images.TryGetValue(type, out moveImages);
            if (moveImages == null)
            {
                moveImages   = new Dictionary <Moves, CanvasBitmap>();
                images[type] = moveImages;
            }

            CanvasBitmap im;

            moveImages.TryGetValue(moves, out im);
            if (im == null)
            {
                im = LoadImage(type, moves, overlay);
                moveImages[moves] = im;
            }

            return(im);
        }
Ejemplo n.º 16
0
        protected internal Block CloneTo(Block original, Moves direction)
        {
            Game  gameInstance = Game.Instance;
            Block clone        = gameInstance.BlockFactory.Get(original.getType(), direction);
            Point point        = new Point(original.Point.X, original.Point.Y);

            Move.UpdatePoint(ref point, direction);
            try
            {
                switch (clone.getType())
                {
                case Type.BLOCK:
                case Type.BLOB:
                case Type.TEETH:
                    if (gameInstance.Level.GetBlockContainer(point.X, point.Y).CanMoveTo(clone))
                    {
                        gameInstance.Level.AddBlock(point.X, point.Y, clone, 2);
                        gameInstance.Level.MoveBlock(clone, null, true, true);
                    }
                    else
                    {
                        //throw new CloneNotSupportedException();
                    }
                    break;

                default:
                    gameInstance.AddBlockDelay(clone, point, 2);
                    break;
                }
            }
            catch (BlockContainerFullException)
            {
            }

            return(clone);
        }
Ejemplo n.º 17
0
 public virtual bool CanMove(Moves direction)
 {
     return(CanMoveFrom() && CanMoveTo(direction));
 }
Ejemplo n.º 18
0
 public BlockMove(Block b, Moves m)
 {
     Block = b;
     Move  = m;
 }
Ejemplo n.º 19
0
 private static bool Move(Block caller, Moves m)
 {
     return(caller.Move(m));
 }
        public virtual void Tick(Block caller)
        {
            Moves m = caller.Facing;

            if (!caller.Move(m))
            {
                int dir = Utils.Random.Next(4);
                for (int i = 0; i < 2; i++)
                {
                    switch (dir)
                    {
                    case 0:
                        if (Move(caller, Moves.UP))
                        {
                            goto outerBreak;
                        }
                        else
                        {
                            caller.Facing = m;
                        }
                        goto case 1;

                    case 1:
                        if (Move(caller, Moves.DOWN))
                        {
                            goto outerBreak;
                        }
                        else
                        {
                            caller.Facing = m;
                        }
                        goto case 2;

                    case 2:
                        if (Move(caller, Moves.LEFT))
                        {
                            goto outerBreak;
                        }
                        else
                        {
                            caller.Facing = m;
                        }
                        goto case 3;

                    case 3:
                        if (Move(caller, Moves.RIGHT))
                        {
                            goto outerBreak;
                        }
                        else
                        {
                            dir           = 0;
                            caller.Facing = m;
                        }
                        break;
                    }
                }

outerBreak:
                ;
            }
        }
        private CanvasBitmap LoadImage(Type type, Moves moves, bool overlay)
        {
            // If overlay, x and y are the overlay coordinates.
            int x = 0;
            int y = 0;

            switch (type)
            {
            case Type.BLOB:
                y = 12;
                x = 5;
                break;

            case Type.BLOCK:
                y = 10;
                x = 0;
                break;

            case Type.BLUEBUTTON:
                y = 8;
                x = 2;
                break;

            case Type.BLUEKEY:
                y = 4;
                x = 6;
                break;

            case Type.BLUELOCK:
                y = 6;
                x = 1;
                break;

            case Type.BLUEWALLREAL:
            case Type.BLUEWALLFAKE:
                y = 14;
                x = 1;
                break;

            case Type.BOMB:
                y = 10;
                x = 2;
                break;

            case Type.BROWNBUTTON:
                y = 7;
                x = 2;
                break;

            case Type.BUG:
                y = 0;
                x = 4;
                break;

            case Type.BURNEDCHIP:
                y = 4;
                x = 3;
                break;

            case Type.CHIP:
                y = 12;
                x = 6;
                break;

            case Type.CLONEBLOCK:
                y = 0;
                x = 1;
                break;

            case Type.CLONEMACHINE:
                y = 1;
                x = 3;
                break;

            case Type.COMPUTERCHIP:
                y = 2;
                x = 0;
                break;

            case Type.DIRT:
                y = 11;
                x = 0;
                break;

            case Type.DROWNEDCHIP:
                y = 3;
                x = 3;
                break;

            case Type.EXIT:
                y = 5;
                x = 1;
                break;

            case Type.FAKEEXIT:
                y = 5;
                x = 1;
                break;

            case Type.FIRE:
                y = 4;
                x = 0;
                break;

            case Type.FIREBOOTS:
                y = 9;
                x = 6;
                break;

            case Type.FIREBALL:
                y = 4;
                x = 4;
                break;

            case Type.FLIPPERS:
                y = 8;
                x = 6;
                break;

            case Type.FLOOR:
                y = 0;
                x = 0;
                break;

            case Type.FORCEFLOOR:
                y = 2;
                x = 1;
                break;

            case Type.RANDOMFORCEFLOOR:
                y = 2;
                x = 3;
                break;

            case Type.GLIDER:
                y = 0;
                x = 5;
                break;

            case Type.GRAVEL:
                y = 13;
                x = 2;
                break;

            case Type.GREENBUTTON:
                y = 3;
                x = 2;
                break;

            case Type.GREENKEY:
                y = 6;
                x = 6;
                break;

            case Type.GREENLOCK:
                y = 8;
                x = 1;
                break;

            case Type.HIDDENWALL:
                y = 0;
                x = 0;
                break;

            case Type.HINT:
                y = 15;
                x = 2;
                break;

            case Type.ICE:
                y = 12;
                x = 0;
                break;

            case Type.ICECORNER:
                y = 10;
                x = 1;
                break;

            case Type.ICEBLOCK:
                y = 10;
                x = 1;
                break;

            case Type.ICESKATES:
                y = 10;
                x = 6;
                break;

            case Type.INVISIBLEWALL:
                y = 0;
                x = 0;
                break;

            case Type.LOCK:     // ?
                break;

            case Type.PARAMECIUM:
                y = 0;
                x = 6;
                break;

            case Type.PINKBALL:
                y = 8;
                x = 4;
                break;

            case Type.RECESSEDWALL:
                y = 14;
                x = 2;
                break;

            case Type.REDBUTTON:
                y = 4;
                x = 2;
                break;

            case Type.REDKEY:
                y = 5;
                x = 6;
                break;

            case Type.REDLOCK:
                y = 7;
                x = 1;
                break;

            case Type.SOCKET:
                y = 2;
                x = 2;
                break;

            case Type.SUCTIONBOOTS:
                y = 11;
                x = 6;
                break;

            case Type.SWIMMINGCHIP:
                y = 12;
                x = 3;
                break;

            case Type.TANK:
                y = 12;
                x = 4;
                break;

            case Type.TEETH:
                y = 4;
                x = 5;
                break;

            case Type.TELEPORT:
                y = 9;
                x = 2;
                break;

            case Type.THIEF:
                y = 1;
                x = 2;
                break;

            case Type.THINWALL:
                y = 6;
                x = 0;
                break;

            case Type.THINWALLSE:
                y = 0;
                x = 3;
                break;

            case Type.TOGGLEWALLCLOSED:
                y = 5;
                x = 2;
                break;

            case Type.TOGGLEWALLOPEN:
                y = 6;
                x = 2;
                break;

            case Type.TRAP:
                y = 11;
                x = 2;
                break;

            case Type.WALKER:
                y = 8;
                x = 5;
                break;

            case Type.WALL:
                y = 1;
                x = 0;
                break;

            case Type.WATER:
                y = 3;
                x = 0;
                break;

            case Type.YELLOWKEY:
                y = 7;
                x = 6;
                break;

            case Type.YELLOWLOCK:
                y = 9;
                x = 1;
                break;
            }

            if (overlay)
            {
                if (x >= 4)
                {
                    x += 3;
                }
            }

            if ((x >= 4 && !(x == 6 && y >= 4 && y <= 11)) || type == Type.SWIMMINGCHIP || type == Type.ICEBLOCK || type == Type.THINWALL || type == Type.ICECORNER)
            {
                switch (moves)
                {
                case Moves.DOWN:
                    y += 2;
                    break;

                case Moves.LEFT:
                    y += 1;
                    break;

                case Moves.RIGHT:
                    y += 3;
                    break;
                }
            }

            if (type == Type.FORCEFLOOR)
            {
                switch (moves)
                {
                case Moves.DOWN:
                    x = 0;
                    y = 13;
                    break;

                case Moves.LEFT:
                    y += 2;
                    break;

                case Moves.RIGHT:
                    y += 1;
                    break;
                }
            }

            CanvasDevice       device = CanvasDevice.GetSharedDevice();
            CanvasRenderTarget image  = new CanvasRenderTarget(device, 32, 32, 96);

            image.CopyPixelsFromBitmap(blockSprites, 0, 0, x * 32, y * 32, 32, 32);

            IDictionary <Type, IDictionary <Moves, CanvasBitmap> > images;

            if (overlay)
            {
                images = loadedImagesOverlay;
            }
            else
            {
                images = loadedImages;
            }

            IDictionary <Moves, CanvasBitmap> movesMap = images[type];

            if (movesMap == null)
            {
                movesMap        = new Dictionary <Moves, CanvasBitmap>();
                movesMap[moves] = image;
                images[type]    = movesMap;
            }
            else
            {
                movesMap[moves] = image;
            }

            return(image);
        }
 private bool Move(Block caller, Moves m)
 {
     caller.Facing = m;
     return(caller.Move(m));
 }
Ejemplo n.º 23
0
        public override Block CreateBlock(Type type, Moves facing)
        {
            Block ret = null;
            IBlockTickBehavior   nullTick       = NullTickBehavior.Instance;
            IButtonBehavior      nullButton     = NullButtonBehavior.Instance;
            CloneBehavior        nullClone      = NullCloneBehavior.Instance;
            ITrapReleaseBehavior defaultTrap    = DefaultTrapReleaseBehavior.Instance;
            BlockReaction        canMove        = CanMove.Instance;
            BlockReaction        cannotMove     = CannotMove.Instance;
            IDestroyBehavior     defaultDestroy = DefaultDestroyBehavior.Instance;

            switch (type)
            {
            case Type.BLOB:
                ret = new Block(type, facing, BlobTickBehavior.Instance, canMove, CreatureTo.Instance, nullButton, BlobCloneBehavior.Instance, defaultTrap, defaultDestroy);
                break;

            case Type.BLOCK:
                ret = new Block(type, facing, nullTick, canMove, BlockTo.Instance, nullButton, CloneSameDirection.Instance, defaultTrap, defaultDestroy);
                break;

            case Type.BLUEBUTTON:
                ret = new Block(type, facing, nullTick, canMove, BlueButtonTo.Instance, nullButton, nullClone, defaultTrap, defaultDestroy);
                break;

            case Type.BLUEKEY:
                ret = new Block(type, facing, nullTick, canMove, BlueKeyTo.Instance, nullButton, nullClone, defaultTrap, defaultDestroy);
                break;

            case Type.BLUELOCK:
                ret = new Block(type, facing, nullTick, canMove, BlueLockTo.Instance, nullButton, nullClone, defaultTrap, defaultDestroy);
                break;

            case Type.BLUEWALLFAKE:
                ret = new Block(type, facing, nullTick, canMove, BlueWallFakeTo.Instance, nullButton, nullClone, defaultTrap, defaultDestroy);
                break;

            case Type.BLUEWALLREAL:
                ret = new Block(type, facing, nullTick, canMove, BlueWallRealTo.Instance, nullButton, nullClone, defaultTrap, defaultDestroy);
                break;

            case Type.BOMB:
                ret = new Block(type, facing, nullTick, canMove, BombTo.Instance, nullButton, nullClone, defaultTrap, defaultDestroy);
                break;

            case Type.BROWNBUTTON:
                ret = new Block(type, facing, nullTick, BrownButtonFrom.Instance, BrownButtonTo.Instance, nullButton, nullClone, defaultTrap, defaultDestroy);
                break;

            case Type.BUG:
                ret = new Block(type, facing, BugTickBehavior.Instance, canMove, CreatureTo.Instance, nullButton, CloneBoss.Instance, ControllerTrapReleaseBehavior.Instance, defaultDestroy);
                break;

            case Type.BURNEDCHIP:
                break;

            case Type.CHIP:
                ret = new Block(type, facing, ChipTickBehavior.Instance, canMove, ChipTo.Instance, nullButton, nullClone, defaultTrap, defaultDestroy);
                Game.Instance.Chip = ret;
                break;

            case Type.CLONEBLOCK:
                break;

            case Type.CLONEMACHINE:
                ret = new Block(type, facing, nullTick, cannotMove, cannotMove, CloneMachineBehavior.Instance, nullClone, defaultTrap, defaultDestroy);
                break;

            case Type.COMPUTERCHIP:
                ret = new Block(type, facing, nullTick, canMove, ComputerChipTo.Instance, nullButton, nullClone, defaultTrap, defaultDestroy);
                break;

            case Type.DIRT:
                ret = new Block(type, facing, nullTick, canMove, DirtTo.Instance, nullButton, nullClone, defaultTrap, defaultDestroy);
                break;

            case Type.DROWNEDCHIP:
                break;

            case Type.EXIT:
                ret = new Block(type, facing, nullTick, canMove, ExitTo.Instance, nullButton, nullClone, defaultTrap, defaultDestroy);
                break;

            case Type.FAKEEXIT:
                break;

            case Type.FIRE:
                ret = new Block(type, facing, nullTick, canMove, FireTo.Instance, nullButton, nullClone, defaultTrap, defaultDestroy);
                break;

            case Type.FIREBOOTS:
                ret = new Block(type, facing, nullTick, canMove, FirebootsTo.Instance, nullButton, nullClone, defaultTrap, defaultDestroy);
                break;

            case Type.FIREBALL:
                ret = new Block(type, facing, FireballTickBehavior.Instance, canMove, CreatureTo.Instance, nullButton, CloneSameDirection.Instance, defaultTrap, defaultDestroy);
                break;

            case Type.FLIPPERS:
                ret = new Block(type, facing, nullTick, canMove, FlippersTo.Instance, nullButton, nullClone, defaultTrap, defaultDestroy);
                break;

            case Type.FLOOR:
                ret = new Block();
                ret.SetType(Type.FLOOR);
                break;

            case Type.FORCEFLOOR:
                ret = new Block(type, facing, nullTick, canMove, ForceFloorTo.Instance, nullButton, nullClone, defaultTrap, defaultDestroy);
                break;

            case Type.RANDOMFORCEFLOOR:
                ret = new Block(type, facing, nullTick, canMove, RandomForceFloorTo.Instance, nullButton, nullClone, defaultTrap, defaultDestroy);
                break;

            case Type.GLIDER:
                ret = new Block(type, facing, GliderTickBehavior.Instance, canMove, CreatureTo.Instance, nullButton, CloneSameDirection.Instance, defaultTrap, defaultDestroy);
                break;

            case Type.GRAVEL:
                ret = new Block(type, facing, nullTick, canMove, GravelTo.Instance, nullButton, nullClone, defaultTrap, defaultDestroy);
                break;

            case Type.GREENBUTTON:
                ret = new Block(type, facing, nullTick, canMove, GreenButtonTo.Instance, nullButton, nullClone, defaultTrap, defaultDestroy);
                break;

            case Type.GREENKEY:
                ret = new Block(type, facing, nullTick, canMove, GreenKeyTo.Instance, nullButton, nullClone, defaultTrap, defaultDestroy);
                break;

            case Type.GREENLOCK:
                ret = new Block(type, facing, nullTick, canMove, GreenLockTo.Instance, nullButton, nullClone, defaultTrap, defaultDestroy);
                break;

            case Type.HIDDENWALL:
                ret = new Block(type, facing, nullTick, canMove, BlueWallRealTo.Instance, nullButton, nullClone, defaultTrap, defaultDestroy);
                break;

            case Type.HINT:
                ret = new Block(type, facing, nullTick, HintFrom.Instance, HintTo.Instance, nullButton, nullClone, defaultTrap, defaultDestroy);
                break;

            case Type.ICE:
                ret = new Block(type, facing, nullTick, IceFrom.Instance, IceTo.Instance, nullButton, nullClone, defaultTrap, defaultDestroy);
                break;

            case Type.ICECORNER:
                ret = new Block(type, facing, nullTick, IceFrom.Instance, IceCornerTo.Instance, nullButton, nullClone, defaultTrap, defaultDestroy);
                break;

            case Type.ICEBLOCK:     // ?
                break;

            case Type.ICESKATES:
                ret = new Block(type, facing, nullTick, canMove, IceskatesTo.Instance, nullButton, nullClone, defaultTrap, defaultDestroy);
                break;

            case Type.INVISIBLEWALL:
                ret = new Block(type, facing, nullTick, canMove, cannotMove, nullButton, nullClone, defaultTrap, defaultDestroy);
                break;

            case Type.LOCK:
                break;

            case Type.PARAMECIUM:
                ret = new Block(type, facing, ParameciumTickBehavior.Instance, canMove, CreatureTo.Instance, nullButton, CloneBoss.Instance, ControllerTrapReleaseBehavior.Instance, defaultDestroy);
                break;

            case Type.PINKBALL:
                ret = new Block(type, facing, PinkballTickBehavior.Instance, canMove, CreatureTo.Instance, nullButton, CloneSameDirection.Instance, defaultTrap, defaultDestroy);
                break;

            case Type.RECESSEDWALL:
                ret = new Block(type, facing, nullTick, canMove, RecessedWallTo.Instance, nullButton, nullClone, defaultTrap, defaultDestroy);
                break;

            case Type.REDBUTTON:
                ret = new Block(type, facing, nullTick, canMove, RedButtonTo.Instance, nullButton, nullClone, defaultTrap, defaultDestroy);
                break;

            case Type.REDKEY:
                ret = new Block(type, facing, nullTick, canMove, RedKeyTo.Instance, nullButton, nullClone, defaultTrap, defaultDestroy);
                break;

            case Type.REDLOCK:
                ret = new Block(type, facing, nullTick, canMove, RedLockTo.Instance, nullButton, nullClone, defaultTrap, defaultDestroy);
                break;

            case Type.SOCKET:
                ret = new Block(type, facing, nullTick, canMove, SocketTo.Instance, nullButton, nullClone, defaultTrap, defaultDestroy);
                break;

            case Type.SUCTIONBOOTS:
                ret = new Block(type, facing, nullTick, canMove, SuctionbootsTo.Instance, nullButton, nullClone, defaultTrap, defaultDestroy);
                break;

            case Type.SWIMMINGCHIP:
                break;

            case Type.TANK:
                TankBehavior    tb = new TankBehavior();
                IButtonBehavior bb = tb;
                ret = new Block(type, facing, tb, canMove, CreatureTo.Instance, bb, CloneSameDirection.Instance, defaultTrap, defaultDestroy);
                Buttons.AddBlueButtonsListener(ret);
                break;

            case Type.TEETH:
                ret = new Block(type, facing, TeethTickBehavior.Instance, canMove, CreatureTo.Instance, nullButton, CloneBoss.Instance, ControllerTrapReleaseBehavior.Instance, defaultDestroy);
                break;

            case Type.TELEPORT:
                ret = new Block(type, facing, nullTick, canMove, TeleportTo.Instance, nullButton, nullClone, defaultTrap, defaultDestroy);
                break;

            case Type.THIEF:
                ret = new Block(type, facing, nullTick, canMove, ThiefTo.Instance, nullButton, nullClone, defaultTrap, defaultDestroy);
                break;

            case Type.THINWALL:
                ret = new Block(type, facing, nullTick, ThinWallFrom.Instance, ThinWallTo.Instance, nullButton, nullClone, defaultTrap, defaultDestroy);
                break;

            case Type.THINWALLSE:
                ret = new Block(type, facing, nullTick, ThinWallSeFrom.Instance, ThinWallSeTo.Instance, nullButton, nullClone, defaultTrap, defaultDestroy);
                break;

            case Type.TOGGLEWALLCLOSED:     // Yes, fallthrough
            case Type.TOGGLEWALLOPEN:
                ret = new Block(type, facing, nullTick, canMove, ToggleWallTo.Instance, ToggleWallBehavior.Instance, nullClone, defaultTrap, defaultDestroy);
                Buttons.AddGreenButtonsListener(ret);
                break;

            case Type.TRAP:
                ret = new Block(type, facing, nullTick, cannotMove, TrapTo.Instance, TrapBehavior.Instance, nullClone, defaultTrap, defaultDestroy);
                break;

            case Type.WALKER:
                ret = new Block(type, facing, WalkerTickBehavior.Instance, canMove, CreatureTo.Instance, nullButton, CloneSameDirection.Instance, defaultTrap, defaultDestroy);
                break;

            case Type.WALL:
                ret = new Block(type, facing, nullTick, canMove, cannotMove, nullButton, nullClone, defaultTrap, defaultDestroy);
                break;

            case Type.WATER:
                ret = new Block(type, facing, nullTick, WaterFrom.Instance, WaterTo.Instance, nullButton, nullClone, defaultTrap, defaultDestroy);
                break;

            case Type.YELLOWKEY:
                ret = new Block(type, facing, nullTick, canMove, YellowKeyTo.Instance, nullButton, nullClone, defaultTrap, defaultDestroy);
                break;

            case Type.YELLOWLOCK:
                ret = new Block(type, facing, nullTick, canMove, YellowLockTo.Instance, nullButton, nullClone, defaultTrap, defaultDestroy);
                break;
            }

            if (ret == null)
            {
                // System.out.println("The block requested hasn't been implemented. Using default behaviors");
                ret = new Block(type, facing);
            }

            return(ret);
        }
Ejemplo n.º 24
0
 public Move(Move.Moves direction)
 {
     Direction = direction;
 }
Ejemplo n.º 25
0
 public virtual bool Move(Moves direction)
 {
     return(Move(direction, false, false));
 }
Ejemplo n.º 26
0
 public virtual bool CanMoveTo(Moves direction)
 {
     return(Game.Instance.Level.GetBlockContainer(this, direction).CanMoveTo(this));
 }
Ejemplo n.º 27
0
 public Block(Type t, Moves m)
 {
     Trapped = false;
     type    = t;
     facing  = m;
 }
Ejemplo n.º 28
0
 public abstract Block CreateBlock(Type type, Moves direction);
Ejemplo n.º 29
0
 public virtual bool Move(Moves direction, bool ignoreFrom, bool ignoreTo)
 {
     return(Game.Instance.Level.MoveBlock(this, direction, ignoreFrom, ignoreTo));
 }