コード例 #1
0
ファイル: AnimPlayer.cs プロジェクト: Gerjo/Gravwar
        public AnimPlayer(Level ownerLevel, int intPlayerIndex)
        {
            this.ownerLevel     = ownerLevel;
            this.intPlayerIndex = intPlayerIndex;

            switch(intPlayerIndex) {
                case 0:
                    playerIndex = PlayerIndex.One;
                    playerColor = Color.Red;
                    break;

                case 1:
                    playerIndex = PlayerIndex.Two;
                    playerColor = Color.Blue;
                    break;
                case 2:
                    playerIndex = PlayerIndex.Three;
                    playerColor = Color.Green;
                    break;
                case 3:
                    playerIndex = PlayerIndex.Four;
                    playerColor = Color.Yellow;
                    break;
            }

            weaponManager       = new WeaponManager(this);
            audio               = new Audio();

            // If controller "one" is connected use controller as input device. Else use the computer's keyboard and mouse.
            if (GamePad.GetState(PlayerIndex.One).IsConnected)
            {
                inputDevice = new GamePadInput(this);
            }
            else if (playerIndex == PlayerIndex.One)
            {
                inputDevice = new KeyboardInput(this);
            }

            // May have to abstract this routine into a "loadContent" function.
            walkingTex      = Game1.INSTANCE.Content.Load<Texture2D>("Images/AnimPlayer/walkingSpriteMap");
            walkingTexGlow  = Game1.INSTANCE.Content.Load<Texture2D>("Images/AnimPlayer/walkingSpriteMapGlow");
            armTex          = Game1.INSTANCE.Content.Load<Texture2D>("Images/AnimPlayer/arm");
            armTexShoot     = Game1.INSTANCE.Content.Load<Texture2D>("Images/AnimPlayer/armflash");
            pixelTex        = Game1.INSTANCE.Content.Load<Texture2D>("Images/AnimPlayer/pixel");
            haltTex         = Game1.INSTANCE.Content.Load<Texture2D>("Images/AnimPlayer/standingStill2");
            haltTexGlow     = Game1.INSTANCE.Content.Load<Texture2D>("Images/AnimPlayer/standingStillGlow");
            deadTex         = Game1.INSTANCE.Content.Load<Texture2D>("Images/AnimPlayer/dead");
            healthFont      = Game1.INSTANCE.Content.Load<SpriteFont>("Fonts/HealthFont");

            // Will spawn the player at said location:
            spawnPlayer(ownerLevel.spawnPositions[intPlayerIndex]);
        }
コード例 #2
0
ファイル: Gameover.cs プロジェクト: Gerjo/Gravwar
 //Constructor
 public GameOver(Level level)
 {
     this.level = level;
     screenFont = Game1.INSTANCE.Content.Load<SpriteFont>("Debug");
 }