Beispiel #1
0
        /// <summary>
        /// Исследование характеристик работы с геометрией
        /// в виде одиночного параллелепипеда
        /// </summary>
        private static void GeometryParallelepipedTests()
        {
            // Примитив - параллелепипед
            Coordinate3D coordinate3D = new Coordinate3D(1m, 1m, 1m);
            GeometryPrimitive3DParallelepiped parallelepiped = new GeometryPrimitive3DParallelepiped(coordinate3D, 5m, 1m, 0.5m);

            NagruzkaRaspredRavnomern nagr1 = new NagruzkaRaspredRavnomern();

            nagr1.Q = new Q(200000, 100000, 50000);
            var areaRectangle1 = new AreaRectangle();

            areaRectangle1.Coordinate3DPointMinDistant = new Coordinate3D(1m, 2m, 0.5m);
            areaRectangle1.Coordinate3DPointMaxDistant = new Coordinate3D(6m, 2m, 1.5m);
            nagr1.Area = areaRectangle1;
            parallelepiped.NagruzkaList.Add(nagr1);

            GeometryElement geometryElement = new GeometryElement3D(new Coordinate3D(0.5m, 1m, 1.5m));

            geometryElement.GeometryPrimitives.Add(parallelepiped);
            geometryElement.GeometryPrimitives.Add(new GeometryPrimitive3DCube(new Coordinate3D(1.1m, 1.2m, 1.1m), 0.15m, true));

            Geometry3D geometry = new Geometry3D();

            geometry.GeometryElements.Add(geometryElement);

            /////////////////////////
            Console.WriteLine("Сериализация объекта: {0}", geometry.ExportToXML("", "GeometryParallelepiped.xml"));
            Geometry3D g2 = (Geometry3D)Geometry.ImportFromXML("", "GeometryParallelepiped.xml");

            Console.WriteLine("Проверка на равенство серализованного и десериализованного объектов: {0}", Geometry3D.IsGeometryValuesEquals(geometry, g2));
        }
Beispiel #2
0
 public CharacterBoard()
 {
     _settings          = DependencyInjection.Resolve <IReadOnlySettings>();
     _mouseInput        = DependencyInjection.Resolve <IMouseInput>();
     _editingArea       = new AreaRectangle(205, 110, 380, 345, new Color(10, 10, 10, 50));
     _characterPosition = new Vector2(400, 450);
 }
Beispiel #3
0
        protected override void Initialize()
        {
            _editArea = new AreaRectangle(100, 50, 400, 450, new Color(255, 255, 255, 100));

            App.Register();
            _mouseComponent    = DependencyInjection.Resolve <IMouseComponent>();
            _mouseInput        = DependencyInjection.Resolve <IMouseInput>();
            _mouseDrawer       = DependencyInjection.Resolve <IMouseDrawer>();
            _settings          = DependencyInjection.Resolve <ISettings>();
            _map               = DependencyInjection.Resolve <IMapComponent>();
            _keyboardComponent = DependencyInjection.Resolve <IKeyboardComponent>();

            base.Initialize();
        }
        public void Update(GameTime gameTime)
        {
            if (AreaRectangle.Intersects(InputHandler.MouseRectangle))
            {
                if (InputHandler.IsWheelMovingDown())
                {
                    MoveDown();
                }
                if (InputHandler.IsWheelMovingUp())
                {
                    MoveUp();
                }
            }

            if (InputHandler.LeftButtonIsClicked())
            {
                if (InputHandler.MouseRectangle.Intersects(BulletRectangle) && !IsLocked)
                {
                    if (!IsDragging)
                    {
                        OffSet = BulletLocation - InputHandler.MousePosition;
                    }
                    IsDragging = true;
                }
                else
                {
                    IsLocked = true;
                }
            }
            else
            {
                IsLocked = IsDragging = false;
            }

            if (IsDragging)
            {
                Drag();
            }
        }