コード例 #1
0
 public PlayerShip(Vector2 position, MyGame.IO.InputManager inputManager)
     : base(position, new Collidable(Textures.Ship, position, Color.White, 0, new Vector2(100, 50), .9f), 500)
 {
     inputManager.Register(forward, this);
     inputManager.Register(back, this);
     inputManager.Register(left, this);
     inputManager.Register(right, this);
 }
コード例 #2
0
 public static void RegisterIO(InputManager ioManager, IOObserver ioObserver)
 {
     ioManager.Register(leftMousePress, ioObserver);
     ioManager.Register(leftMouseRelease, ioObserver);
     ioManager.Register(rightMousePress, ioObserver);
     ioManager.Register(rightMouseRelease, ioObserver);
     ioManager.Register(constructCombat, ioObserver);
     ioManager.Register(constructTransport, ioObserver);
     ioManager.Register(createCompany, ioObserver);
     ioManager.Register(ctrPress, ioObserver);
     ioManager.Register(ctrRelease, ioObserver);
 }
コード例 #3
0
        public static PlayerShip Factory(Vector2 position, MyGame.IO.InputManager inputManager)
        {
            //GunnerController gunner0 = GunnerController.CreateGunner(0);
            //GunnerController gunner1 = GunnerController.CreateGunner(1);
            PlayerShip ship = new PlayerShip(position, inputManager);

            GameObject.Collection.Add(ship);

            /*PlayerRotatingGun gun1 = new PlayerRotatingGun(this, new Vector2(0, 25), (float)(Math.PI / 2), gunner0);
             * GameObject.Collection.Add(gun1);
             * PlayerRotatingGun gun2 = new PlayerRotatingGun(this, new Vector2(0, -25), (float)(-Math.PI / 2), gunner1);
             * GameObject.Collection.Add(gun2);
             * this.GameState.AddLocalUpdateable(gunner0);
             * this.GameState.AddLocalUpdateable(gunner1);*/
            return(ship);
        }
コード例 #4
0
 public PlayerGun(Ship parent, Vector2 positionRelativeToParent, float directionRelativeToParent, InputManager inputManager)
     :base(parent, positionRelativeToParent, directionRelativeToParent)
 {
     inputManager.Register(space, this);
 }
コード例 #5
0
 public PlayerRotatingGun(Ship parent, Vector2 positionRelativeToParent, float directionRelativeToParent, InputManager inputManager)
     : base(parent, positionRelativeToParent, directionRelativeToParent, (float)(Math.PI * .5))
 {
     inputManager.Register(space, this);
 }
コード例 #6
0
 public static void Initialize(MyGraphicsClass graphics, InputManager inputManager, Camera camera)
 {
     Vector2 screenSize = new Vector2(graphics.getGraphics().PreferredBackBufferWidth, graphics.getGraphics().PreferredBackBufferHeight);
     GunnerController.inputManager = inputManager;
     GunnerController.camera = camera;
     screen = new Utils.RectangleF(new Vector2(0), screenSize);
 }