Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            var pathToData = "./Data/input.txt";

            if (args.Length == 1)
            {
                pathToData = args[0];
            }
            var points = PointCreator.ReadPointsFromFile(pathToData).ToList();

            for (var i = 0; i < points.Count; i++)
            {
                Console.WriteLine($"{i}-{points[i].X};{points[i].Y}");
            }

            var GS  = new GrahamScan(points);
            var res = GS.GetSortPoints().ToList();

            Console.WriteLine(Environment.NewLine);
            Console.WriteLine("Result:");
            for (var i = 0; i < res.Count; i++)
            {
                Console.WriteLine($"{i}-{res[i].X};{res[i].Y}");
            }
            Console.WriteLine("Press any key...");
            Console.ReadKey();
        }
Ejemplo n.º 2
0
 // Update is called once per frame
 void Update()
 {
     if (Vector3.Distance(transform.position, Gameboard.transform.position) > Gameboard.GetComponent <Renderer>().bounds.extents.x * 2.125f)
     {
         isactivated = false;
         PointCreator.SpawnEnemy();
     }
     if (isactivated == true)
     {
         var temp = GetComponent <Rigidbody2D>().velocity.y;
         temp = Mathf.Clamp(temp, -Mathf.Infinity, 5);
         if (DirRight && transform.position.x > 4.5f)
         {
             DirRight = false;
         }
         else if (!DirRight && transform.position.x < -4.5f)
         {
             DirRight = true;
         }
         if (DirRight)
         {
             GetComponent <Rigidbody2D>().velocity = new Vector2(0.5f, temp);
             transform.Rotate(Vector3.forward * -1f);
         }
         else if (!DirRight)
         {
             GetComponent <Rigidbody2D>().velocity = new Vector2(-0.5f, temp);
             transform.Rotate(Vector3.forward * 1f);
         }
     }
     else
     {
         transform.position = spawnpoint;
     }
 }
Ejemplo n.º 3
0
        public static IEnumerable <IGameObject> InitCollection()
        {
            list = new List <IGameObject>();

            GridCreator.Grid = GridCreator.CreateGrid(PointCreator.CreatePoints());

            var background = BaseGameObject.CreateStaticObject(AnimationType.MazeBlue, 0, 0);

            var tempList = PointCreator.CreatePoints().Select(GameObjectCreator.CreateOGameObject).Where(x => x != null).ToList();

            var pac = tempList.OfType <Pacman>().First();

            GrandArbiter grandArbiter = new GrandArbiter

            {
                Maze = (Background)background,

                Blinky = tempList.OfType <Blinky>().First()
            };

            pac.Arbiter = grandArbiter;

            list.Add(background);

            list.AddRange(tempList);

            return(list);
        }
        /// <summary>
        /// remove point
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Remove_Point(object sender, RoutedEventArgs e)
        {
            this.Hide();
            var pointCreator = new PointCreator();

            pointCreator.Remove();
            this.Show();
        }
Ejemplo n.º 5
0
        private void Start()
        {
            list = new List <Vector2>
            {
            };

            wg             = new WallGenerator();
            fg             = new FloorGenerator();
            arrayChecker   = new ArrayChecker();
            inputChecker   = new InputChecker();
            pointGenerator = new PointCreator();
        }
Ejemplo n.º 6
0
        public static void GetPoint()
        {
            GrxApp.DocumentManager.MdiActiveDocument.Editor.Command("PDMODE", "35");

            var helper = new PickPartHelper();

            if (helper.Pick())
            {
                var ui = new GetPointUI();

                var ptCreator = new PointCreator();
                ptCreator.Create(helper.KeyPoints);

                GrxApp.ShowModelessWindow(GrxApp.MainWindow.Handle, ui);
            }
        }
Ejemplo n.º 7
0
    private void DisplayDrillings(Drillings drillings)
    {
        for (int i = parent.childCount - 1; i >= 0; i--)
        {
            Destroy(parent.GetChild(i).gameObject);
        }

        for (int i = 0; i < drillings.AllDrillingsRounded.Count; i++)
        {
            Drilling     d     = drillings.AllDrillingsRounded[i];
            PointCreator point = Instantiate <PointCreator>(prefabPoint);
            point.CreatePointIndex(i + 1);

            float x = (float)(d.Coord.X * 2 * NORMA_RADIUS / drillings.Diameter);
            float y = (float)(d.Coord.Y * 2 * NORMA_RADIUS / drillings.Diameter);

            point.transform.SetParent(parent);
            point.transform.localPosition = new Vector3(x, y, -20);
            point.transform.localScale    = new Vector3(0.1f, 0.1f, 0);
        }
    }
Ejemplo n.º 8
0
            public static Creator Get(CadFigure.Types createType, CadFigure fig)
            {
                CadFigure.Types type = createType;

                Creator creator = null;

                switch (type)
                {
                case Types.LINE:
                    creator = new LineCreator(fig);
                    break;

                case Types.RECT:
                    creator = new RectCreator(fig);
                    break;

                case Types.POLY_LINES:
                    creator = new PolyLinesCreator(fig);
                    break;

                case Types.CIRCLE:
                    creator = new CircleCreator(fig);
                    break;

                case Types.POINT:
                    creator = new PointCreator(fig);
                    break;

                case Types.DIMENTION_LINE:
                    creator = new DimLineCreator(fig);
                    break;

                default:
                    break;
                }

                return(creator);
            }
Ejemplo n.º 9
0
        public static void ErasePoint()
        {
            var ptCreator = new PointCreator();

            ptCreator.Remove();
        }
Ejemplo n.º 10
0
        public static void AddPoint()
        {
            var ptCreator = new PointCreator();

            ptCreator.Add();
        }
Ejemplo n.º 11
0
 public HomeController(SortFactory sortFactory, PointCreator pointCreator)
 {
     _sortFactory  = sortFactory;
     _pointCreator = pointCreator;
 }