Пример #1
0
            public bool SetSubjectOfInteration(GameController controller, int dx, int dy)
            {
                HelperInteration = new InteractionObjects(controller.view.Location, controller.view.Width - 20, controller.view.Height - 70);
                PointSubject     = new Point(controller.model.GetPlayer().LocateX + controller.view.Location.X + dx,
                                             controller.model.GetPlayer().LocateY + controller.view.Location.Y + dy);
                WidthSubject  = controller.model.GetPlayer().GetRectangle().Width;
                HeightSubject = controller.model.GetPlayer().GetRectangle().Height;

                if (this.HelperInteration.IsLocated(this.PointSubject, this.WidthSubject, this.HeightSubject) == true)
                {
                    return(true);
                }
                return(false);
            }
Пример #2
0
        public void TimerMoving()
        {
            if (this.view.GetKeyPress().IsDownUp == true)
            {
                InteractionObjects helperWithInteration = new InteractionObjects(view.Location, view.Width, view.Height);
                Point pointSubject  = new Point(model.GetPlayer().LocateX + view.Location.X, model.GetPlayer().LocateY + view.Location.Y - 5);
                int   widthSubject  = model.GetPlayer().GetImagePlayer().Width;
                int   heightSubject = model.GetPlayer().GetImagePlayer().Height;
                if (helperWithInteration.IsLocated(pointSubject, widthSubject, heightSubject) == true)
                {
                    this.model.GetPlayer().LocateY -= 5;
                }
            }

            if (this.view.GetKeyPress().IsDownRight == true)
            {
                InteractionObjects helperWithInteration = new InteractionObjects(view.Location, view.Width, view.Height);
                Point pointSubject  = new Point(model.GetPlayer().LocateX + view.Location.X + 5, model.GetPlayer().LocateY + view.Location.Y);
                int   widthSubject  = model.GetPlayer().GetImagePlayer().Width;
                int   heightSubject = model.GetPlayer().GetImagePlayer().Height;
                if (helperWithInteration.IsLocated(pointSubject, widthSubject, heightSubject) == true)
                {
                    this.model.GetPlayer().LocateX += 5;
                }
            }

            if (this.view.GetKeyPress().IsDownDown == true)
            {
                InteractionObjects helperWithInteration = new InteractionObjects(view.Location, view.Width, view.Height);
                Point pointSubject  = new Point(model.GetPlayer().LocateX + view.Location.X, model.GetPlayer().LocateY + view.Location.Y + 5);
                int   widthSubject  = model.GetPlayer().GetImagePlayer().Width;
                int   heightSubject = model.GetPlayer().GetImagePlayer().Height;
                if (helperWithInteration.IsLocated(pointSubject, widthSubject, heightSubject) == true)
                {
                    this.model.GetPlayer().LocateY += 5;
                }
            }

            if (this.view.GetKeyPress().IsDownLeft == true)
            {
                InteractionObjects helperWithInteration = new InteractionObjects(view.Location, view.Width, view.Height);
                Point pointSubject  = new Point(model.GetPlayer().LocateX + view.Location.X - 5, model.GetPlayer().LocateY + view.Location.Y);
                int   widthSubject  = model.GetPlayer().GetImagePlayer().Width;
                int   heightSubject = model.GetPlayer().GetImagePlayer().Height;
                if (helperWithInteration.IsLocated(pointSubject, widthSubject, heightSubject) == true)
                {
                    this.model.GetPlayer().LocateX -= 5;
                }
            }
        }
Пример #3
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);


            InteractionObjects a = new InteractionObjects(new Point(50, 50), 50, 300);
            bool mm = a.IsLocated(new Point(5, 5), 300, 300);

            GameView       view       = new GameView();
            GameModel      model      = new GameModel();
            GameController controller = new GameController(view, model);

            Application.Run(view);
        }
Пример #4
0
        public void StartTask(bool isDownF)
        {
            if (this.view.GetKeyPress().IsDownF == true)
            {
                Point point = new Point(model.GetPlayer().LocateX, model.GetPlayer().LocateY);
                int   w     = model.GetPlayer().GetImage().Width;
                int   h     = model.GetPlayer().GetImage().Height;
                InteractionObjects player = new InteractionObjects(point, w, h);

                if (player.IsIntersection(new Point(model.GetPatient().LocateX - 30,
                                                    model.GetPatient().LocateY - 30),
                                          model.GetPatient().GetImage().Width + 60,
                                          model.GetPatient().GetImage().Height + 60) == true)
                {
                    TaskController taskController = new TaskController(new TaskModel(), new Tasks.TaskView());
                    taskController.GetTaskView().ShowDialog();
                    taskController.GetTaskView().Hide();
                }
                this.view.GetKeyPress().IsDownF = false;
            }
        }