public override void UseBoost(Player player, Unit[,] units)
        {
            PlayerControlManager pcm = new PlayerControlManager(0, 0, null, null);

            int[]      playerCenter = pcm.getCenterPlayer(new int[] { player.x, player.y });
            int[]      playerTile   = pcm.getTile(playerCenter[0], playerCenter[1]);
            Teleporter t            = new Teleporter(playerTile[0], playerTile[1]);

            TeleporterChangeVisitor visitor = new TeleporterChangeVisitor(t);

            for (int x = 0; x < units.GetLength(0); x++)
            {
                for (int y = 0; y < units.GetLength(1); y++)
                {
                    if (units[x, y] != null)
                    {
                        units[x, y].Accept(visitor);
                    }
                }
            }
        }
Exemplo n.º 2
0
        public override Block CreateBlock(string type, int x, int y)
        {
            Block toReturn = null;

            switch (type)
            {
            case "Wall":
                toReturn = new Wall(x, y);
                break;

            case "Box":
                toReturn = new Box(x, y);
                break;

            case "Teleporter":
                toReturn = new Teleporter(x, y);
                break;

            default:
                break;
            }
            return(toReturn);
        }
Exemplo n.º 3
0
 public TeleporterChangeVisitor(Teleporter teleporter)
 {
     Teleporter = teleporter;
 }
Exemplo n.º 4
0
 public void SetDestination(Teleporter destination)
 {
     this.destination = destination;
     hasDestination   = true;
 }