Ejemplo n.º 1
0
        private void CheckBranchingConnection()
        {
            List <GridTile> branches = thisGrid.GetBranches(thisEngine.GetBranchesCount());

            foreach (GridTile b in branches)
            {
                BranchingConveyor branch    = b.nodeInGrid as BranchingConveyor;
                List <GridTile>   tempNeigh = thisGrid.GetNeighboursIn4Directions(b);
                foreach (GridTile neighbours in tempNeigh)
                {
                    if (neighbours.nodeInGrid == null || neighbours.nextTile == b)
                    {
                        continue;
                    }
                    int id = pathFinder.FindFinalDropOff(neighbours.nodeInGrid, 0);
                    if (id != 0)
                    {
                        bool notInDic = true;
                        foreach (var nexts in branch.ReturnNextsDic())
                        {
                            if (nexts.Key == id && nexts.Value == neighbours.nodeInGrid)
                            {
                                notInDic = false;
                                break;
                            }
                        }
                        if (notInDic)
                        {
                            branch.AddNextToDictionary(id, neighbours.nodeInGrid);
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public Node AddNode(string buildType)
        {
            switch (buildType)
            {
            case "Conveyor":
                Conveyor co = new Conveyor();
                conveyors.Add(co);
                return(co);

            case "CheckIn":
                CheckIn ch = new CheckIn();
                checkIns.Add(ch);
                return(ch);

            case "DropOff":
                DropOff dr = new DropOff();
                dropOffs.Add(dr);
                return(dr);

            case "Branch":
                BranchingConveyor br = new BranchingConveyor();
                branchingConveyors.Add(br);
                return(br);
            }
            return(null);
        }