コード例 #1
0
ファイル: Engine.cs プロジェクト: snke07/TanksAndPlanes
        public void AddObject(GameObject obj)
        {
            if (obj is Tank)
            {
                Tank newTank = obj as Tank;
                theTank.Destroy();
                theTank = newTank;
            }

            allObjects.Add(obj);
        }
コード例 #2
0
ファイル: Engine.cs プロジェクト: snke07/TanksAndPlanes
        public Engine(IUserInterface userInterface, ICollisionDispatcher collisionDispatcher, IRenderer renderer, Tank theTank, IEnemyFactory enemy, int sleepTimeInMs)
        {
            this.userInterface = userInterface;
            this.collisionDispatcher = collisionDispatcher;
            this.renderer = renderer;
            this.theTank = theTank;
            this.sleepTime = sleepTimeInMs;
            this.enemy = enemy;
            this.score = 0;
            this.lastLevelScore = 0;

            allObjects = new List<GameObject>();
            allObjects.Add(theTank);
        }
コード例 #3
0
        static void Main()
        {
            int worldRows = Coordinates.worldRows;
            int worldColums = Coordinates.worldColums;
            Coordinates endOfWorld = new Coordinates(worldRows, worldColums);

            IUserInterface userInterface = new KeyboardUserInterface();
            ICollisionDispatcher collisionDispatcher = new CollisionDispatcher();
            IRenderer renderer = new ConsoleRenderer(worldRows, worldColums);
            Tank theTank = new Tank(new Coordinates(worldRows - 1, worldColums / 2));
            IEnemyFactory enemy = new PlaneProducer(endOfWorld, 8);

            Engine gameEngine  = new Engine(userInterface, collisionDispatcher, renderer, theTank, enemy, 100);

            gameEngine.Run();
        }
コード例 #4
0
        public Engine(IUserInterface userInterface, ICollisionDispatcher collisionDispatcher, IRenderer renderer, Tank theTank, IEnemyFactory enemy, int sleepTimeInMs)
        {
            this.userInterface       = userInterface;
            this.collisionDispatcher = collisionDispatcher;
            this.renderer            = renderer;
            this.theTank             = theTank;
            this.sleepTime           = sleepTimeInMs;
            this.enemy          = enemy;
            this.score          = 0;
            this.lastLevelScore = 0;

            allObjects = new List <GameObject>();
            allObjects.Add(theTank);
        }