Beispiel #1
0
        public void InitFigures()
        {
            _figures.Clear();
            //main
            Cube c1 = new Cube(new Point(_startP), new Point(_startP.X - 80, _startP.Y + 30, _startP.Z - 60));

            //cabin
            Point p1 = new Point(_startP.X - 80, _startP.Y, _startP.Z);
            Cube cabine = new Cube(p1, new Point(p1.X-50, p1.Y+30, p1.Z - 60));

            //hood
            Point p2 = new Point(_startP.X - 130, _startP.Y, _startP.Z);
            Cube hood = new Cube(p2, new Point(p2.X, p2.Y + 30, p2.Z), new Point(p2.X - 50, p2.Y, p2.Z - 60), new Point(p2.X - 50, p2.Y+25, p2.Z - 60));

            Length = Math.Abs(_startP.X - p2.X) + 50;

            //roof
            Point p3 = new Point(_startP.X-80, _startP.Y+50, _startP.Z);
            Cube roof = new Cube(p3, new Point(p3.X-25, p3.Y+3, p3.Z-60));

            //racks
            int rackWidth = 6;

            Point rP1 = new Point(_startP.X-80, _startP.Y+30, _startP.Z);
            Cube leftBackRack = new Cube(rP1, new Point(rP1.X, rP1.Y+20, rP1.Z), new Point(rP1.X-rackWidth, rP1.Y, rP1.Z-2*rackWidth), new Point(rP1.X-rackWidth, rP1.Y+20, rP1.Z - 2 * rackWidth));

            Point rP2 = new Point(_startP.X-80, _startP.Y+30, _startP.Z-60+2*rackWidth);
            Cube rightBackRack = new Cube(rP2, new Point(rP2.X - rackWidth, rP2.Y + 20, rP2.Z - 2*rackWidth));
                //new Cube(rP2, new Point(rP2.X, rP2.Y + 20, rP2.Z), new Point(rP2.X - rackWidth, rP2.Y, rP2.Z + 2*rackWidth), new Point(rP2.X - rackWidth, rP2.Y + 20, rP2.Z + 2 * rackWidth));

            Point rP3 = new Point(_startP.X-130+rackWidth, _startP.Y+30, _startP.Z);
            Cube leftFrontRack = new Cube(rP3, new Point(rP3.X+25, rP3.Y+20, rP3.Z), new Point(rP3.X-rackWidth, rP3.Y, rP3.Z-rackWidth), new Point(rP3.X+25-rackWidth, rP3.Y+20, rP3.Z-rackWidth));

            Point rP4 = new Point(_startP.X - 130, _startP.Y + 30, _startP.Z-60);
            Cube rightFrontRack = new Cube(rP4, new Point(rP4.X+25, rP4.Y+20, rP4.Z), new Point(rP4.X+rackWidth, rP4.Y, rP4.Z+rackWidth), new Point(rP4.X+25+rackWidth, rP4.Y+20, rP4.Z+rackWidth));

            //wheels
            int wheelWidth = 15;

            Point wheelP1 = new Point(_startP.X - 160, _startP.Y - 5, _startP.Z + 2);
            Cylinder leftFrontWheel = new Cylinder(_radius, wheelP1, new Point(wheelP1.X, wheelP1.Y, wheelP1.Z - wheelWidth));

            Point wheelP2 = new Point(_startP.X - 160, _startP.Y - 5, _startP.Z - 62);
            Cylinder rightFrontWheel = new Cylinder(_radius, wheelP2, new Point(wheelP2.X, wheelP2.Y, wheelP2.Z + wheelWidth));

            Point wheelP3 = new Point(_startP.X - 50, _startP.Y - 5, _startP.Z + 2);
            Cylinder leftMidWheel = new Cylinder(_radius, wheelP3, new Point(wheelP3.X, wheelP3.Y, wheelP3.Z - wheelWidth));

            Point wheelP4 = new Point(_startP.X - 50, _startP.Y - 5, _startP.Z - 62);
            Cylinder rightMidWheel = new Cylinder(_radius, wheelP4, new Point(wheelP4.X, wheelP4.Y, wheelP4.Z + wheelWidth));

            Point wheelP5 = new Point(_startP.X - 15, _startP.Y - 5, _startP.Z + 2);
            Cylinder leftBackWheel = new Cylinder(_radius, wheelP5, new Point(wheelP5.X, wheelP5.Y, wheelP5.Z - wheelWidth));

            Point wheelP6 = new Point(_startP.X - 15, _startP.Y - 5, _startP.Z - 62);
            Cylinder rightBackWheel = new Cylinder(_radius, wheelP6, new Point(wheelP6.X, wheelP6.Y, wheelP6.Z+wheelWidth));

            leftFrontWheel.reverseCrashX();
            leftMidWheel.reverseCrashX();
            leftBackWheel.reverseCrashX();
            rightFrontWheel.reverseCrashX();
            rightMidWheel.reverseCrashX();
            rightBackWheel.reverseCrashX();

            _figures.Add(c1);
            _figures.Add(cabine);
            _figures.Add(hood);
            _figures.Add(roof);

            _figures.Add(leftBackRack);
            _figures.Add(rightBackRack);
            _figures.Add(leftFrontRack);
            _figures.Add(rightFrontRack);

            _figures.Add(leftBackWheel);
            _figures.Add(rightBackWheel);
            _figures.Add(leftMidWheel);
            _figures.Add(rightMidWheel);
            _figures.Add(leftFrontWheel);
            _figures.Add(rightFrontWheel);

            int i = 0;
            foreach (Figure f in _figures)
            {
                if (i < 8)
                {
                    f.SetDirection(-1);
                    f.SetTexture(_textureObject);
                }
                else
                {
                    f.SetTexture(_wheels);
                }
                i++;
            }
        }
Beispiel #2
0
        public void InitFigures()
        {
            _figures.Clear();
            Cube c1 = new Cube(_startP, new Point(_startP.X+80, _startP.Y+30, _startP.Z-60));
            //            c1.SetColor(1.0f, 1.0f, 0f);

            //hood
            Point p1 = new Point(_startP.X + 80, _startP.Y, _startP.Z);
            Cube hood = new Cube(p1, new Point(p1.X, p1.Y + 30, p1.Z), new Point(p1.X + 50, p1.Y, p1.Z - 60), new Point(p1.X + 50, p1.Y+20, p1.Z - 60));

            Length = Math.Abs(_startP.X - p1.X) + 50;

            //roof
            Point p2 = new Point(_startP.X+10, _startP.Y+50, _startP.Z);
            Cube roof = new Cube(p2, new Point(p2.X+45, p2.Y+3, p2.Z-60));

            int rackWidth = 7;
            //back racks
            Point p3 = new Point(_startP.X, _startP.Y + 30, _startP.Z);
            Cube rightBackRack = new Cube(p3, new Point(p3.X + 10, p3.Y+20, p3.Z), new Point(p3.X + 15, p3.Y, p3.Z - rackWidth), new Point(p3.X + 15, p3.Y + 20, p3.Z - rackWidth));

            Point p4 = new Point(_startP.X, _startP.Y + 30, _startP.Z - 60 + rackWidth);
            Cube leftBackRack = new Cube(p4, new Point(p4.X + 10, p4.Y + 20, p4.Z), new Point(p4.X + 15, p4.Y, p4.Z - rackWidth), new Point(p4.X + 15, p4.Y + 20, p4.Z - rackWidth));

            //front racks
            Point p5 = new Point(_startP.X + 80, _startP.Y+30, _startP.Z);
            Cube rightFrontRack = new Cube(p5, new Point(p5.X - rackWidth, p5.Y, p5.Z), new Point(p5.X - 25, p5.Y + 20, p5.Z - rackWidth), new Point(p5.X - 25 - rackWidth, p5.Y + 20, p5.Z - rackWidth));

            Point p6 = new Point(_startP.X + 80, _startP.Y+30, _startP.Z - 60 + rackWidth);
            Cube leftFrontRack = new Cube(p6, new Point(p6.X - rackWidth, p6.Y, p6.Z), new Point(p6.X - 25, p6.Y + 20, p6.Z - rackWidth), new Point(p6.X - 25 - rackWidth, p6.Y + 20, p6.Z - rackWidth));

            //wheels
            int wheelWidth = 12;

            Point wheelP1 = new Point(_startP.X + 25, _startP.Y, _startP.Z + 2);
            Cylinder rightBackWheel = new Cylinder(_radius, wheelP1, new Point(wheelP1.X, wheelP1.Y, wheelP1.Z-wheelWidth));

            Point wheelP2 = new Point(_startP.X + 25, _startP.Y, _startP.Z - 62);
            Cylinder leftBackWheel = new Cylinder(_radius, wheelP2, new Point(wheelP2.X, wheelP2.Y, wheelP2.Z+wheelWidth));

            Point wheelP3 = new Point(_startP.X + 100, _startP.Y, _startP.Z - 62);
            Cylinder leftFrontWheel = new Cylinder(_radius, wheelP3, new Point(wheelP3.X, wheelP3.Y, wheelP3.Z+wheelWidth));

            Point wheelP4 = new Point(_startP.X + 100, _startP.Y, _startP.Z + 2);
            Cylinder rightFrontWheel = new Cylinder(_radius, wheelP4, new Point(wheelP4.X, wheelP4.Y, wheelP4.Z-wheelWidth));

            _figures.Add(c1);
            _figures.Add(hood);
            _figures.Add(roof);
            _figures.Add(leftBackRack);
            _figures.Add(rightBackRack);
            _figures.Add(rightFrontRack);
            _figures.Add(leftFrontRack);
            _figures.Add(rightBackWheel);
            _figures.Add(leftBackWheel);
            _figures.Add(rightFrontWheel);
            _figures.Add(leftFrontWheel);

            int i = 0;
            foreach (Figure f in _figures)
            {
                if (i<7)
                    f.SetTexture(_textureObject);
                else
                    f.SetTexture(_wheels);
                i++;
            }
        }