Exemplo n.º 1
0
        public static void Lesson15_DelegatesAndEvents()
        {
            PlayerCar pcar = new PlayerCar("Car1", 1, 1);

            pcar.PrintCurrentPosition();
            pcar.CheckCarPostion();
            pcar.MoveUpX(1);
            pcar.PrintCurrentPosition();
            pcar.CheckCarPostion();
        }
Exemplo n.º 2
0
        static void Lesson21_Extensions()
        {
            int x = 4;

            Console.WriteLine(x.MyIncrement(7));
            Console.WriteLine(x.MyDecrement(3));

            var mycar = new PlayerCar("Car1", 1, 1);

            mycar.accelerationOfMovement = 1;
            mycar.AddAccelerationOfMovement(10);
            Console.WriteLine(mycar.accelerationOfMovement);
        }
Exemplo n.º 3
0
        static void Lesson13()
        {
            PlayerCar pcar = new PlayerCar("car1", 1, 100);

            pcar.PrintCurrentPosition();
            pcar.position.PrintCurrentPosition();
            EnemyCar enCar = new EnemyCar("enemyCar", 1, 222);

            enCar.PrintCurrentPosition();
            enCar.position.PrintCurrentPosition();

            Car newCar = (Car)pcar;

            newCar.PrintCurrentPosition();
            newCar.position.PrintCurrentPosition();
        }
Exemplo n.º 4
0
        static void Lesson10()
        {
            PlayerCar playerCar = new PlayerCar("SportCar", 10, 100);

            Console.WriteLine($"Player car Start position:");
            playerCar.PrintCurrentPosition();
            EnemyCar enemyCar = new EnemyCar("BigBoss", 15, 200);

            Console.WriteLine($"Enemy car Start position:");
            enemyCar.PrintCurrentPosition();

            playerCar.position.movePosition(1, 1);
            enemyCar.position.movePosition(2, 2);

            Console.WriteLine($"Player car:");
            playerCar.PrintCurrentPosition();
            Console.WriteLine($"Enemy car:");
            enemyCar.PrintCurrentPosition();
        }
Exemplo n.º 5
0
        static void Lesson11()
        {
            PlayerCar playerCar1 = new PlayerCar("SportCar1", 10, 100);
            PlayerCar playerCar2 = new PlayerCar("SportCar2", 10, 100);

            playerCar2.position.movePosition(5, 5);
            playerCar1.position = playerCar1.position + playerCar2.position;
            playerCar1.PrintCurrentPosition();

            /////
            ///
            playerCar1.position = new Position(0, 0);
            playerCar2.position = new Position(0, 1);
            Console.WriteLine(playerCar1.position < playerCar2.position);
            Console.WriteLine(playerCar1.position > playerCar2.position);
            Console.WriteLine(playerCar1.position <= playerCar2.position);
            Console.WriteLine(playerCar1.position >= playerCar2.position);
            Console.WriteLine(playerCar1.position == playerCar2.position);
            Console.WriteLine(playerCar1.position != playerCar2.position);
        }