Esempio n. 1
0
 public Subscription(MyCar myCar, Renderer renderer)
 {
     this.renderer = renderer;
     this.myCar    = myCar;
     this.myCar.MoveMyCarLeftEvent  += MoveMyCarLeft;
     this.myCar.MoveMyCarRightEvent += MoveMyCarRight;
     //this.otherCars = otherCars;
     // foreach (var otherCar in otherCars)
     // otherCar.CarCrashEvent += ChangeLives;
 }
Esempio n. 2
0
        public void GetFigures()
        {
            FigureFabric figureFabric = new FigureFabric();

            this.field       = figureFabric.GetField();
            this.myCar       = figureFabric.GetMyCar('o', ConsoleColor.White);
            this.border      = figureFabric.GetBorder('*', ConsoleColor.DarkMagenta);
            this.borderHoles = figureFabric.GetBorder(' ', ConsoleColor.DarkMagenta);
            this.gameLogic   = figureFabric.GetGameLogic();
            this.display     = figureFabric.GetDisplay();
        }
Esempio n. 3
0
        private bool IsCarsCrash(MyCar myCar, OtherCar otherCar)
        {
            bool result = false;

            foreach (var car in myCar.Nodes)
            {
                foreach (var otherCars in otherCar.Nodes)
                {
                    if (car.X == otherCars.X && car.Y == otherCars.Y)
                    {
                        result = true;
                    }
                }
            }
            return(result);
        }