コード例 #1
0
        public CursorComponent(Game game, int playerNum, WorldComponent world, ContentManager content)
            : base(game)
        {
            this.content = content;
            cursorPos = new Vector2(640, 360);
            this.world = world;

            if (playerNum == 0)
            {
                playerIndex = PlayerIndex.One;
                myKeys = new Keys[6] { Keys.W, Keys.S, Keys.A, Keys.D, Keys.Space, Keys.Tab };
                gunPointers = new Vector2[3] { new Vector2(10, 718), new Vector2(55, 718), new Vector2(100, 718) };

            }
            else
            {
                playerIndex = PlayerIndex.Two;
                myKeys = new Keys[6] { Keys.Up, Keys.Down, Keys.Left, Keys.Right, Keys.Enter, Keys.RightShift };
                gunPointers = new Vector2[3] { new Vector2(24, 718), new Vector2(69, 718) , new Vector2(114,718)};

            }
            this.game = game;
            this.playerNum = playerNum;
            currentMouseState = Mouse.GetState();
        }
コード例 #2
0
ファイル: Game1.cs プロジェクト: elorense/ShooterDefense
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            graphics.PreferredBackBufferHeight = BackBufferHeight;
            graphics.PreferredBackBufferWidth = BackBufferWidth;
            Content.RootDirectory = "Content";
            world = new WorldComponent(this);
            crossHair1 = new CursorComponent(this, 0, world, Content);
            crossHair2 = new CursorComponent(this, 1, world, Content);
            enemy = new Enemy(this, world.treasureBounds, 0);
            menuScreen = new MenuScreen(this, enemy);
            Components.Add(crossHair1);
            Components.Add(crossHair2);
            crossHair1.mEnemy = enemy;
            crossHair2.mEnemy = enemy;
            crossHair1.menuScreen = menuScreen;
            crossHair2.menuScreen = menuScreen;

            //graphics.ToggleFullScreen();
        }