예제 #1
0
        public GridTile AddTileAtCoordinates(GridTile toReplace, Node newNode, string buildType)
        {
            GridTile t = null;

            switch (buildType)
            {
            case "Conveyor":
                t = new ConveyorTile(toReplace.Column, toReplace.Row, tileWidth, tileHeight);
                break;

            case "CheckIn":
                t = new CheckInTile(toReplace.Column, toReplace.Row, tileWidth, tileHeight);
                break;

            case "DropOff":
                t = new DropOffTile(toReplace.Column, toReplace.Row, tileWidth, tileHeight);
                break;

            case "Branch":
                t = new BranchTile(toReplace.Column, toReplace.Row, tileWidth, tileHeight);
                break;
            }
            gridTiles.Remove(toReplace);
            gridTiles.Add(t);
            t.nodeInGrid = newNode;
            return(t);
        }
예제 #2
0
        public Form1()
        {
            InitializeComponent();
            grBoxBuildType.Visible = false;

            cmBoxNodeFlights.Visible   = false;
            listBNodeInfoList.Visible  = false;
            btnFlightToCheckIn.Visible = false;
            btnFlightToDropOff.Visible = false;
            lblDropOffFLID.Visible     = false;

            thisGrid      = new Grid(animationBox.Width, animationBox.Height);
            thisEngine    = new Engine();
            pathFinder    = new PathFinder();
            flightManager = new FlightManager();

            buildType          = "Conveyor";
            isBuildingConveyor = false;
            isConnecting       = false;

            System.Timers.Timer aTimer = new System.Timers.Timer();
            aTimer.Elapsed += new ElapsedEventHandler(TimerSequence);
            aTimer.Interval = 1000;
            aTimer.Enabled  = true;

            GridTile t = thisGrid.FindTileInRowColumnCoordinates(0, 0);

            t = thisGrid.AddTileAtCoordinates(t, thisEngine.AddNode(buildType), buildType);
            t = thisGrid.FindTileInRowColumnCoordinates(0, 1);
            t = thisGrid.AddTileAtCoordinates(t, thisEngine.AddNode(buildType), buildType);
            t = thisGrid.FindTileInRowColumnCoordinates(0, 2);
            t = thisGrid.AddTileAtCoordinates(t, thisEngine.AddNode(buildType), buildType);
            t = thisGrid.FindTileInRowColumnCoordinates(0, 3);
            t = thisGrid.AddTileAtCoordinates(t, thisEngine.AddNode(buildType), buildType);
            t = thisGrid.FindTileInRowColumnCoordinates(1, 3);
            t = thisGrid.AddTileAtCoordinates(t, thisEngine.AddNode(buildType), buildType);
            t = thisGrid.FindTileInRowColumnCoordinates(2, 3);
            t = thisGrid.AddTileAtCoordinates(t, thisEngine.AddNode(buildType), buildType);
            t = thisGrid.FindTileInRowColumnCoordinates(8, 8);
            t = thisGrid.AddTileAtCoordinates(t, thisEngine.AddNode("DropOff"), "DropOff");
            DropOffTile d  = t as DropOffTile;
            DropOff     dd = d.nodeInGrid as DropOff;

            dd.FlightID = 111;
            Conveyor c = thisEngine.firstConveyor();

            c.baggageHeld = new Baggage(111);
            List <Conveyor> conveyors = thisEngine.GetConveyors();

            for (int i = 0; i < conveyors.Count - 1; i++)
            {
                thisEngine.ConnectNodes(conveyors[i], conveyors[i + 1]);
            }
        }