Пример #1
0
        public CharacterSelect(GameModel gameModel, MyAbstractions.Tgc3dSound init)
        {
            this.gameModel = gameModel;
            this.init      = init;
            this.init.play(true);
            this.planes.Add(new Plane(new TGCVector3(-90, 0, -90), new TGCVector3(90, 0, 90), new TGCVector3(0, 1, 0), "Otros\\Paredes\\2.jpg", 1, 1));
            this.planes.Add(new Plane(new TGCVector3(-90, 0, -90), new TGCVector3(-90, 50, 90), new TGCVector3(1, 0, 0), "Otros\\Paredes\\1.jpg", 1, 1));
            this.planes.Add(new Plane(new TGCVector3(90, 0, -90), new TGCVector3(90, 50, 90), new TGCVector3(-1, 0, 0), "Otros\\Paredes\\4.jpg", 1, 1));
            this.planes.Add(new Plane(new TGCVector3(-90, 0, -90), new TGCVector3(90, 50, -90), new TGCVector3(0, 0, 1), "Otros\\Paredes\\3.jpg", 1, 1));
            this.gameModel.Camara = new ThirdPersonCamera(new TGCVector3(0, 0, 0), 100f, 150f);

            this.soundManager = new SoundsManager();
            var auto1 = new Van(new TGCVector3(0f, 0f, 0f), soundManager);

            auto1.matrixs.SetScalation(TGCMatrix.Scaling(0.2f, 0.2f, 0.2f));
            auto1.Transform();

            this.soundManager = new SoundsManager();
            var auto2 = new Car(new TGCVector3(0f, 0f, 0f), soundManager);

            auto2.matrixs.SetScalation(TGCMatrix.Scaling(0.3f, 0.3f, 0.3f));
            auto2.Transform();

            this.soundManager = new SoundsManager();
            var auto3 = new Hummer(new TGCVector3(0f, 0f, 0f), soundManager);

            auto3.matrixs.SetScalation(TGCMatrix.Scaling(0.25f, 0.25f, 0.25f));
            auto3.Transform();

            autos = new List <Vehicle>
            {
                auto1,
                auto2,
                auto3
            };

            selectedCar = auto1;
            CarsCount   = autos.Count - 1;


            var deviceWidth  = D3DDevice.Instance.Width;
            var deviceHeight = D3DDevice.Instance.Height;

            choose          = new CustomSprite();
            choose.Bitmap   = new CustomBitmap(MediaDir + "GUI\\Menu\\choose.png", D3DDevice.Instance.Device);
            choose.Position = new TGCVector2((deviceWidth / 2f) - choose.Bitmap.Width / 2, deviceHeight * 0.6f);

            rightArrow          = new CustomSprite();
            rightArrow.Bitmap   = new CustomBitmap(MediaDir + "GUI\\Menu\\right-arrow.png", D3DDevice.Instance.Device);
            rightArrow.Position = new TGCVector2(deviceWidth / 2 + rightArrow.Bitmap.Width * 3 / 4, deviceHeight / 2 - rightArrow.Bitmap.Height * 0.2f);
            rightArrow.Scaling  = new TGCVector2(0.2f, 0.2f);

            leftArrow          = new CustomSprite();
            leftArrow.Bitmap   = new CustomBitmap(MediaDir + "GUI\\Menu\\right-arrow.png", D3DDevice.Instance.Device);
            leftArrow.Rotation = FastMath.PI;
            leftArrow.Position = new TGCVector2(deviceWidth / 2 - leftArrow.Bitmap.Width * 3 / 4, deviceHeight / 2);
            leftArrow.Scaling  = new TGCVector2(0.2f, 0.2f);
        }
Пример #2
0
        static void Main(string[] args)
        {
            // 使用接口
            IArmyCar ha = new Hummer();

            ha.run();
            ha.stop();

            // 使用接口
            IPersonCar hp = new Hummer();

            hp.run();
            hp.stop();

            // 使用具体类
            Hummer h = new Hummer();

            h.run();
            h.stop();

            Console.ReadLine();
        }
Пример #3
0
        static void Main(string[] args)
        {
            //    SportCar a = new SportCar(1, 2, 2, "1", 2, 1, 1);
            //    Console.WriteLine(a.BakVolume(1));
            //    Console.WriteLine(a.Fuel(1, 1));
            //    Console.WriteLine(a.Maslo(1));
            //    Console.WriteLine(a.Omivaika(1, 2));
            //    Console.WriteLine(a.Time(2));
            //    a.printVoditel();
            //    MuscleCar m = new MuscleCar(1, 1, 1, "232", 2, 1, 1);
            //    Console.WriteLine(m.Maslo(1));
            //    Vnedorojnik v = new Vnedorojnik(1, 1, 1, "11", 1, 1, 1, "juju");
            //    Console.WriteLine(v.jujuj());
            //    Console.WriteLine(v.Maslo(1));
            //    Ferarri f = new Ferarri(1, 1, 1, "11", 1, 1, 1, 1);
            //    f.EstPeperoni();
            //    Lamborginy l = new Lamborginy(1, 1, 1, "111", 1, 1, 1, 's');
            //    l.GnatPoDoroge();
            //    Shevrolet s = new Shevrolet(1, 1, 1, " asd", 1, 1, 1, false);
            //    s.Lomatsya();
            //    Hummer h = new Hummer(1, 1, 1, "111", 1, 1, 1, "sad", 1);
            //1//////////////////////////////////////
            //Mustang[] ms =
            //{
            //    new Mustang(7, 7, 7, "7", 7, 7, 7, "7"),
            //    new Mustang(6, 6, 6, "6", 6, 6, 6, "6")
            //};
            //Mustang m1 = new Mustang(0, 0, 0, "", 0, 0, 0, "0");
            //ms = m1.Soort(ms);

            //foreach (var item in ms)
            //{
            //    item.Show();
            //}

            //m1.Add();
            //m1.Show();
            //m1.Polezniy1();
            //m1.Polezniy2();
            //m1.Polezniy3();
            // 2///////////////////////////////////////
            SportCar    a = new SportCar(1, 2, 2, "1", 2, 1, 1);
            MuscleCar   m = new MuscleCar(1, 1, 1, "232", 2, 1, 1);
            Vnedorojnik v = new Vnedorojnik(1, 1, 1, "11", 1, 1, 1, "juju");
            Ferarri     f = new Ferarri(1, 1, 1, "11", 1, 1, 1, 1);
            Lamborginy  l = new Lamborginy(1, 1, 1, "111", 1, 1, 1, 's');
            Shevrolet   s = new Shevrolet(1, 1, 1, " asd", 1, 1, 1, false);
            Hummer      h = new Hummer(1, 1, 1, "111", 1, 1, 1, "sad", 1);

            SoapFormatter soapformatter = new SoapFormatter();

            // получаем поток, куда будем записывать сериализованный объект
            using (FileStream fs = new FileStream("cars.soap", FileMode.OpenOrCreate))
            {
                soapformatter.Serialize(fs, a);
                soapformatter.Serialize(fs, m);
                soapformatter.Serialize(fs, f);
                soapformatter.Serialize(fs, l);
                soapformatter.Serialize(fs, s);
                soapformatter.Serialize(fs, h);
                soapformatter.Serialize(fs, v);
                Console.WriteLine("Объект сериализован");
            }

            //XmlSerializer xmlformatter = new XmlSerializer(typeof(Lamborginy));
            //using (FileStream fs = new FileStream("persons.xml", FileMode.OpenOrCreate))
            //{
            //    xmlformatter.Serialize(fs, l);
            //    Console.WriteLine("Объект сериализован");
            //}

            BinaryFormatter Binformatter = new BinaryFormatter();

            // получаем поток, куда будем записывать сериализованный объект
            using (FileStream fs = new FileStream("people.dat", FileMode.OpenOrCreate))
            {
                Binformatter.Serialize(fs, l);
                Binformatter.Serialize(fs, m);
                Binformatter.Serialize(fs, f);
                Binformatter.Serialize(fs, l);
                Binformatter.Serialize(fs, h);
                Binformatter.Serialize(fs, h);
                Binformatter.Serialize(fs, v);

                Console.WriteLine("Объект сериализован");
            }
        }