示例#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;
 }
示例#2
0
文件: Renderer.cs 项目: evgie/Racing
        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();
        }
示例#3
0
文件: Renderer.cs 项目: evgie/Racing
        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);
        }