当前位置: 首页>>代码示例>>C#>>正文


C# Player.LoadContent方法代码示例

本文整理汇总了C#中Player.LoadContent方法的典型用法代码示例。如果您正苦于以下问题:C# Player.LoadContent方法的具体用法?C# Player.LoadContent怎么用?C# Player.LoadContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Player的用法示例。


在下文中一共展示了Player.LoadContent方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LoadPlayer

 private void LoadPlayer()
 {
     var playerLoader = new XmlManager<Player>();
     Player = playerLoader.Load("Load/Gameplay/Player.xml");
     Player.LoadContent();
     ScreenManager.Instance.CenterImage(Player.Image);
 }
开发者ID:gioragutt,项目名称:training,代码行数:7,代码来源:GameplayScreen.cs

示例2: LoadContent

        public override void LoadContent()
        {
            Background tempBack = new Background(TheGame.Content.Load<Texture2D>(@"Maps/Level2/underwaterlvl"), TheSpriteBatch);

            player = new Player(TheGame, TheSpriteBatch,
                new Vector2(100,
                    500));
            player.LoadContent();

            //Loading the Enemy Sprites
            enemy = new Vortex(TheGame, TheSpriteBatch,
                new Vector2(200,
                    200));
            enemy.LoadContent();

            spawnManager = new SpawnManager(TheGame, TheSpriteBatch);

            //Object Manager
            objectManager.RegisterObject(tempBack);
            objectManager.RegisterObject(enemy);
            objectManager.RegisterObject(player);
            collisionManager.RegisterObject(player);
            collisionManager.RegisterObject(enemy);

            levelLoaded = true;
        }
开发者ID:midlas10,项目名称:XNA_mappe3_Bouncing,代码行数:26,代码来源:LevelTwo.cs

示例3: SpecialLevel

    public SpecialLevel(int roomNumber, string name, bool saved = false)
    {
        drawSaveText = saved;
        firstTime = true;

        //Adding the player and grid
        player = new Player(Vector3.Zero);
        player.Parent = this;
        tileGrid = LoadLevel(name);
        tileGrid.Parent = this;
        gameObjects.Add(tileGrid);
        player.LoadContent();
        gameObjects.Add(player);

        //Setting the roomcounter
        roomCounter = new TextGameObject("text");
        roomCounter.text = roomNumber.ToString();
        //Adding the hanging man
        if (roomCounter.text == "100")
        {
            BillBoard man = new BillBoard(new Vector3(700, 210, 200));
            man.Parent = this;
            gameObjects.Add(man);
        }

        if (drawSaveText)
        {
            saveText = new TextGameObject("text");
            saveText.text = "Progress Saved";
            saveText.Position = new Vector2((GameEnvironment.Screen.X - saveText.Size.X) / 2, 0);
        }
        if (name == "Content\\Special Levels\\Final.txt")
            exitText.text = "Press E to kill yourself";
        else
            exitText.text = "Press E to proceed";

        //Adding the roomcounter
        gameObjects.Add(roomCounter);

        //Adding stamina
        stamina = new Stamina();
        stamina.Parent = this;
        gameObjects.Add(stamina);
    }
开发者ID:FancyPandaSoftworks,项目名称:IntroProject,代码行数:44,代码来源:SpecialLevel.cs

示例4: LoadContent

        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            Tiles.Content = Content;
            
            //Laddar från XML 
            weaponXML = Content.Load<Weapon>("XMLConfigs\\Weapons\\Weapon_Basic");
            armoryXML = Content.Load<Armory>("XMLConfigs\\Armory\\Armory_Basic");

            //Fonts
            spriteFont = Content.Load<SpriteFont>("Fonts/DebugFont");
            spriteFontBold = Content.Load<SpriteFont>("Fonts/DebugFontBold");

            //player2 = Content.Load<Player2>("XMLConfigs\\Player\\Player2").Clone() as Player2;

            map.Generate(new int[,]
            {
                {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},
                {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},
                {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},
                {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},
                {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},
                {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},
                {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},
                {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},
                {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},
                {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},
                {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},
                {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,},
            }, 64);
            
            player = Content.Load<Player>("XMLConfigs\\Player\\Player1");
            player.LoadContent(Content);

            GC.Collect();
        }
开发者ID:elefantstudio-se,项目名称:ElefantStudio-Prototyp-Exempel,代码行数:37,代码来源:PlatformEngine.cs

示例5: RandomLevel

    /// <summary>
    /// Creating/generating the level itself
    /// </summary>
    /// <param name="roomNumber">The number of the room</param>
    /// <param name="tiles">The size the Mainpath should be, counted in tiles</param>
    /// <param name="chased">Whether or not the monster is chasing the player</param>
    public RandomLevel(int roomNumber, int tiles = 12, bool chased = false, int noteID = 0)
    {
        //Setting a boolean for the monster
        this.chased = chased;

        //Assining the variables
        tileList = new Dictionary<Point, Tile>();
        keyList = new List<Point>();

        random = GameEnvironment.Random;

        //Select the tiles to use
        int pathType = random.Next(4);
        if (pathType < 9)
            pathID = "0" + (pathType + 1);
        else
            pathID = "" + (pathType + 1);

        int wallType = random.Next(4);
        if (wallType < 9)
            wallID = "0" + (wallType + 1);
        else
            pathID = "" + (wallType + 1);
        newTile = new EntryTile(pathID);
        this.tiles = tiles;

        //Create the startpoint
        position = Point.Zero;
        tileList.Add(position, newTile);
        keyList.Add(position);

        //Creating the paths
        CreateMainPath();
        for (int i = random.Next(1, (int)Math.Pow(tiles,2/3)); i > 0; i--)
            CreateSidePath(random.Next(3, 15), chased);

        //making the tile grid
        TileGrid tileGrid = Grid;
        gameObjects.Add(tileGrid);

        //making the player
        player = new Player(Vector3.Zero);
        gameObjects.Add(player);
        player.Parent = this;
        player.LoadContent();

        foreach(GameObject obj in tileGrid.Objects)
        {
            if (obj != null)
                if(obj.ID == "EntryTile")
                {
                    player.Position = new Vector3(obj.Position.X, obj.Position.Y + GameObjectGrid.CellHeight, obj.Position.Z);
                    foreach(GameObject tile in tileGrid.Objects)
                    {
                        if (tile != null)
                        {
                            if (tile.Position.X == obj.Position.X + 200 && tile.Position.Z == obj.Position.Z && tile.ID == "PathTile")
                                player.viewAngleX = 0f;
                            if (tile.Position.X == obj.Position.X && tile.Position.Z == obj.Position.Z + 200 && tile.ID == "PathTile")
                                player.viewAngleX = (float)(Math.PI / 2);
                            if (tile.Position.X == obj.Position.X - 200 && tile.Position.Z == obj.Position.Z && tile.ID == "PathTile")
                                player.viewAngleX = (float)(Math.PI);
                            if (tile.Position.X == obj.Position.X && tile.Position.Z == obj.Position.Z - 200 && tile.ID == "PathTile")
                                player.viewAngleX = (float)(Math.PI * 1.5);
                        }
                    }
                }
        }

        //Adding decoration objects
        TileGrid grid = Find("TileGrid") as TileGrid;
        for (int x = 0; x < grid.Columns; x++)
            for (int y = 0; y < grid.Rows; y++)
                if (grid.Get(x, y) != null)
                {
                    if (grid.Get(x, y).ID == "WallTile" && GameEnvironment.Random.Next(15) == 0)
                    {
                        try
                        {
                            if (grid.Get(x + 1, y) != null && grid.Get(x + 1, y).ID == "PathTile" && grid.Get(x + 1, y).ID != "DecorationTile")
                            {
                                AddDecoration(grid.Get(x, y).Position, new Vector3(-1, 0, 0));
                                grid.Add(new DecorationTile(pathID), x + 1, y);
                            }
                            else if (grid.Get(x, y + 1) != null && grid.Get(x, y + 1).ID == "PathTile" && grid.Get(x, y + 1).ID != "DecorationTile")
                            {
                                AddDecoration(grid.Get(x, y).Position, new Vector3(0, 0, -1));
                                grid.Add(new DecorationTile(pathID), x, y + 1);
                            }
                            else if (grid.Get(x - 1, y) != null && grid.Get(x - 1, y).ID == "PathTile" && grid.Get(x - 1, y).ID != "DecorationTile")
                            {
                                AddDecoration(grid.Get(x, y).Position, new Vector3(1, 0, 0));
                                grid.Add(new DecorationTile(pathID), x - 1, y);
                            }
//.........这里部分代码省略.........
开发者ID:FancyPandaSoftworks,项目名称:IntroProject,代码行数:101,代码来源:RandomLevel.cs

示例6: LoadContent

        //------------------------------------------------------------------------------
        // Method: LoadContent
        // Author: nholmes
        // Summary: load everything needed for the main game
        //------------------------------------------------------------------------------
        public override void LoadContent()
        {
            // load the background texture
            backgroundTexture = content.Load<Texture2D>(@"game\background\background");
            foregroundTexture = content.Load<Texture2D>(@"game\background\foreground");

            // create the shadow system and cause it to load
            shadowSystem = new ShadowSystem();
            shadowSystem.LoadContent(content);

            // initialise the players - note that while the players are standard game objects we do NOT
            // add them to the game object managers list of managed objects but instead update them manually
            // this is to ensure that the player can be processed before any other objects etc
            playerOne = new Player(game, gameObjectManager, displayManager, new Vector2(128, 128), PlayerIndex.One, shadowSystem, 1);
            playerTwo = new Player(game, gameObjectManager, displayManager, new Vector2(256, 128), PlayerIndex.Two, shadowSystem, 2);

            // load the players content (this is normally handled by the game object manager - but see above)
            playerOne.LoadContent(content);
            playerTwo.LoadContent(content);

            // create a random number generator for the bugs
            Random random = new Random();

            // create some bugs!
            for (int i = 0; i < 50; i++)
            {
                gameObjectManager.AddObject(new GreenBug(game, gameObjectManager, displayManager, new Vector2(-128 - (i * 64) - random.Next(16), 345 + random.Next(64)), shadowSystem, random));
            }

            // once the load has finished, we must tell the timer system that we have
            // finished a very long frame, so it does not try to catch up
            timerSystem.ResetElapsedTime();
        }
开发者ID:GunioRobot,项目名称:IndieCity-XBLIG-to-PC-XNA-helper-library,代码行数:38,代码来源:MainGame.cs

示例7: LoadContent

        protected override void LoadContent()
        {
            content = Content;

            spriteBatch = new SpriteBatch(GraphicsDevice);

            font = Content.Load<SpriteFont>("CourierNew");

            stoneTile = Content.Load<Texture2D>("stone");
            grassTile = Content.Load<Texture2D>("grass");
            dirtTile = Content.Load<Texture2D>("dirt");
            iron_oreTile = Content.Load<Texture2D>("iron_ore");
            airTile = Content.Load<Texture2D>("air");
            obsidianTile = Content.Load<Texture2D>("obsidian");

            player = new Player();
            player.LoadContent(Content.Load<Texture2D>("steve"));

            World world = new World("world");
            worlds.Add(world.getName(), world);
            player.world = world.getName();

            toolbarTile = Content.Load<Texture2D>("UIContent/toolbar");
            selectionTile = Content.Load<Texture2D>("Mouse/selection");
        }
开发者ID:patrickfreed,项目名称:SideCraft--Old-,代码行数:25,代码来源:SideCraft.cs

示例8: LoadContent

        /// <summary>
        /// This functions loads the content for the level.
        /// </summary>
        /// <param name="fileStream">stream used to load level from text file</param>
        /// <param name="difficulty">difficulty setting to create level in</param>
        /// <param name="gameplayTextures">gameplay textures (i.e. background/tiles)</param>
        /// <param name="playerTextures">player animation textures</param>
        /// <param name="playerSounds"> player sound effects</param>
        /// <param name="enemyTextures">enemy animation textures</param>
        public void LoadContent(
            Stream fileStream, 
            DifficultyType difficultyType, 
            Texture2D[] gameplayTextures,
            Texture2D[] playerTextures,
            SoundEffect[] playerSounds,
            Texture2D[] enemyTextures)
        {
            switch (difficultyType) //difficulty state switch
            {
                case DifficultyType.Easy:
                    difficulty = new Easy();
                    break;
                case DifficultyType.Medium:
                    difficulty = new Medium();
                    break;
                case DifficultyType.Hard:
                    difficulty = new Hard();
                    break;
            }

            this.winScore = difficulty.winScore;
            this.textureLimit = difficulty.textureLimit;
            this.difficultyType = difficultyType;

            timeCount = TimeSpan.FromMinutes(0.0); //set start time of game to zero

            this.backgroundTexture = gameplayTextures[0]; //load background texture

            //load the tile textures
            this.platformTexture = gameplayTextures[1];
            this.floorATexture = gameplayTextures[2];
            this.floorBTexture = gameplayTextures[3];
            this.floorEdgeLTexture = gameplayTextures[4];
            this.floorEdgeRTexture = gameplayTextures[5];
            LoadTiles(fileStream); //load the tile map

            player = new Player(playerStart);
            player.LoadContent(playerTextures, playerSounds);

            //create new enemy list (i.e. room for multiple enemies)
            enemies = new List<Enemy>();
            enemySpawn = 0;
            enemyIndex = 0;
            this.enemyTextures = enemyTextures;
            walkLeft = false;
            enemyKilled = playerSounds[2];
            LoadEnemy(); //load an initial enemy
        }
开发者ID:egmcdonald,项目名称:radio,代码行数:58,代码来源:Level.cs

示例9: HandleClientMessages


//.........这里部分代码省略.........
                                Vector2 pos = msg.ReadVector2();
                                float size = msg.ReadFloat();

                                if(i < remnants.Count)
                                {
                                    remnants[i].position = pos;
                                    remnants[i].size = size;
                                    remnants[i].lastUpdatedValues = System.Environment.TickCount - lastReceivedLocationUpdate;
                                }
                                else
                                {
                                    CollisionRemnant newRemnant = new CollisionRemnant(pos, size, Color.GhostWhite, spriteBatch.GraphicsDevice, null);
                                    remnants.Add(newRemnant);
                                }

                                if (numRemnants < remnants.Count)
                                    remnants.RemoveRange(numRemnants - 1, remnants.Count - numRemnants);
                            }

                            lastReceivedLocationUpdate = System.Environment.TickCount;
                            break;
                        //A new player has joined the server which has to be added to this client
                        case ShapeCustomNetMessageType.NewPlayerJoined:
                            int indexOnServer = msg.ReadInt32();
                            ShapeTeam team = (ShapeTeam)msg.ReadByte();
                            int power = msg.ReadInt32();

                            Player newPlayer = new Player(spriteBatch.GraphicsDevice);

                            newPlayer.indexOnServer = indexOnServer;
                            newPlayer.SetTeam(team);
                            newPlayer.power = power;

                            newPlayer.LoadContent(cManager);

                            playersOnSameServer[indexOnServer] = newPlayer;

                            //MessageBox.Show("New player jioned");
                            break;
                        case ShapeCustomNetMessageType.SetupSuccessful:
                            //Have our index on server handed to us
                            player.indexOnServer = msg.ReadInt32();
                            player.SetTeam((ShapeTeam)msg.ReadByte());

                            int numOfPlayers1 = msg.ReadInt32();

                            for (int i = 0; i < numOfPlayers1; i++ )
                            {
                                Player p = new Player(spriteBatch.GraphicsDevice);
                                int index = msg.ReadInt32();
                                p.indexOnServer = index;
                                p.SetTeam((ShapeTeam)msg.ReadByte());

                                int powaar = msg.ReadInt32();
                                //p.power = powaar;

                                p.LoadContent(cManager);

                                playersOnSameServer[index] = p;
                            }
                            break;
                        case ShapeCustomNetMessageType.SetupFailed:
                            MessageBox.Show(msg.ReadString());
                            break;
                    }
                    break;
开发者ID:TheKalleAnka,项目名称:ShapeSpace,代码行数:67,代码来源:GameComponent.cs


注:本文中的Player.LoadContent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。