Ejemplo n.º 1
0
        public static EventHandler RoadMoveHandler()
        {
            return delegate ( object sender, EventArgs args )
            {
                var road = sender as Road;

                MoveStage moveStage = road.IsCanMoveDown(holl);// as MoveStage;

                switch( moveStage )
                {
                    case MoveStage.OK:
                        {
                            holl.EraseFrom(road);
                            holl.MoveDown();
                            holl.WriteTo(road);

                            break;
                        }
                    case MoveStage.COLLISION:
                        {
                            //break the car or something similar

                            break;
                        }
                    case MoveStage.OUT_OF_RANGE:
                        {
                            holl.EraseFrom(road);
                            var rnd = new Random();
                            var tmp = car[0, 0];

                            holl = new Holl( rnd.Next(0, tmp.Row - 1), rnd.Next(0, road.Cols - 1) );
                        //    holl.WriteTo(road);
                            break;
                        }
                }

            };
        }
Ejemplo n.º 2
0
 static Game()
 {
     car = new Car(5, 5);
     road = new Road(10, 21);
     holl = new Holl(10, 0);
 }