예제 #1
0
        public CollisionEntity AddEntity(System.Drawing.Size size)
        {
            var returnvalue = new CollisionEntity(this, size, 4);

            entities.Add(returnvalue);

            return returnvalue;
        }
예제 #2
0
        public CollisionEntity AddEntity(System.Drawing.Size size)
        {
            var returnvalue = new CollisionEntity(this, size, 4);

            entities.Add(returnvalue);

            return(returnvalue);
        }
예제 #3
0
 public CarImpl(Size dim,Size gameFieldSize, CollisionEntity entity,Size size)
 {
     this.dim = dim;
     this.Angle = 0;
     this.Size = size;
     this.Car = CT_Helper.resizeImage(Properties.Resources.Taxi_GTA2, this.Size);
     this.destroyedCar=CT_Helper.resizeImage(Properties.Resources.GTA2_CAR_71,this.Size);
     this.entity = entity;
     this.carCon = new CarController();
     this.Location = new Point(dim.Width / 2 - this.Car.Width / 2, dim.Height / 2 - this.Car.Height / 2);
     this.gameFieldSize = gameFieldSize;
     this.Destroyed = false;
 }
예제 #4
0
파일: Game.cs 프로젝트: ddg-igh/crazy-taxi
        private void loadMap()
        {
            DateTime start;
            gameSize = new Size(size.Width * 10, size.Height * 10);
            //Bilderordner angebe
            MapParser.ImagePath = string.Format(@"{0}{1}MapImages", Directory.GetCurrentDirectory(), Path.DirectorySeparatorChar);
            start = DateTime.Now;

            Random rnd = new Random();
            int random = rnd.Next(0, 3);
            switch (random)
            {
                case 0:
                    map = MapParser.Load(100, 100, MapParser.SpecialMapElement.RiverCrossing);
                    break;
                case 1:
                    map = MapParser.Load(100, 100, MapParser.SpecialMapElement.None);
                    break;
                case 2:
                    map = MapParser.Load(100, 100, MapParser.SpecialMapElement.CentralPark);
                    break;
            }

            Console.WriteLine("MapParser.Load:" + (System.DateTime.Now - start).ToString());
            //Karte vergrößert sich automatisch mit GUI
            //Karte im GUI anzeigen
            start = DateTime.Now;
            map.Initialize(gameSize);
            Console.WriteLine("MapParser.init:" + (System.DateTime.Now - start).ToString());
            //Karte an Größe des GUIs anpassen
            start = DateTime.Now;
            miniMap = map.DrawImage(size);
            Console.WriteLine("MapParser.draw:" + (System.DateTime.Now - start).ToString());

            int entityHeight = size.Height / 39;
            int entityWidth = size.Width / 120;
            Size entitySize = new Size(entityWidth, entityHeight);
            Size carSize = new Size(entityHeight, entityWidth);
            entity = map.Collision.AddEntity(entitySize);
            car = new CarImpl(size, gameSize, entity, carSize);
            car.Location = map.GetRandomTilePosition(true, gameSize);

            loaded = true;
        }
예제 #5
0
파일: CT_UI.cs 프로젝트: ddg-igh/crazy-taxi
        private void Initilize()
        {
            if (!_initialized)
            {
                Fullscreen();
                _Dimension = GetResolution();
                Size size = new Size((int)(_Dimension[0] * 1.2), (int)(_Dimension[1] * 1.2));
                img = Properties.Resources._3;
                img = CT_Helper.resizeImage(img, size);

                #region Menu
                int drawingPointWidth = _Dimension[0] / 2;
                int drawingPointHeight = _Dimension[1] / 2;
                Point menu = new Point(drawingPointWidth - 683 / 2, drawingPointHeight - 384 / 2);
                menuContainer = new DoubleBufferedPanel(menu);

                menuContainer.Width = _Dimension[0];
                menuContainer.Height = _Dimension[1];

                menuContainer.Location = new Point(0, 0);
                menuContainer.Name = "Menu";

                menuHolder = new DoubleBufferedPanel();

                string[] buttonTexts = { "Starten", "Laden", "Speichern", "Fortsetzen", "Beenden", "Highscore" };
                int positionMultiplicator = 1;
                int offset = 10;
                foreach (string text in buttonTexts)
                {

                    VistaButton button = new VistaButton();
                    button.ButtonText = text;

                    button.Width = 136;
                    button.Height = 38;
                    button.Location = new Point(offset + button.Width / 4, (button.Height + offset) * positionMultiplicator);
                    menuHolder.Controls.Add(button);
                    positionMultiplicator++;
                    button.Click += Button_Click;
                    button.KeyDown += CT_UI_KeyDown;
                    button.KeyUp += CT_UI_KeyUp;
                    button.BackColor = Color.Transparent;
                    button.BaseColor = Color.Transparent;
                    button.ButtonColor = Color.FromArgb(155, Color.DarkSlateGray);
                    button.GlowColor = Color.LightGray;
                    button.Font = new System.Drawing.Font("Pricedown", 16.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                    button.CornerRadius = 8;
                }

                this.Controls.Add(menuContainer);
                this.Controls.Add(menuHolder);
                menuHolder.BringToFront();
                menuHolder.BorderStyle = BorderStyle.Fixed3D;
                menuHolder.Width = 683;
                menuHolder.Height = 384;
                menuHolder.Location = menu;
                menuHolder.BackColor = Color.Black;
                menuContainer.BackColor = Color.FromArgb(150, Color.Black);

                #endregion

                #region car
                carpanel = new CarPanel(_Dimension);
                //this.Controls.Add(carpanel);
                #endregion

                setCursor();
                this.Focus();

                //Bilderordner angeben
                MapParser.ImagePath = string.Format(@"{0}{1}MapImages", Directory.GetCurrentDirectory(), Path.DirectorySeparatorChar);
                //Karte aus XML laden
                //map = MapParser.Load(@"C:\Users\Bongo\Desktop\Berufsschule\Diagramme AE\Game\CrazyTaxi\testmap.xml");
                map = MapParser.Load(20, 20);
                //Karte vergrößert sich automatisch mit GUI
                //Karte im GUI anzeigen

                //Karte an Größe des GUIs anpassen
                map.Initialize(new Size(_Dimension[0], _Dimension[1]));
                this.BackgroundImage = map.DrawImage(new Size(_Dimension[0],_Dimension[1]));
                this.TransparencyKey = Color.FromArgb(255, 255, 254);
                this.Controls.Add(carpanel);
                map.Collision.SetDebugTarget(this);
                entity = map.Collision.AddEntity(new Size(12,23));

                _initialized = true;
            }
        }
예제 #6
0
파일: Form1.cs 프로젝트: ddg-igh/crazy-taxi
 private void test(CollisionEntity entity)
 {
     map.Collision.ResetDebugOutput();
     var res = entity.Update(pt, deg, true);
     label1.Text = "Front: " + res.Front;
 }