コード例 #1
0
        public override void LoadContent()
        {
            var abilityIcon = _content.Load <Texture2D>("Battle/AbilityIcon");

            var position = new Vector2(200, 500);

            _actors = _players.Select(c =>
            {
                var player = new Player(_content, position, _graphics.GraphicsDevice)
                {
                    ActorModel     = c,
                    LeftHandWeapon = GetWeapon(c.EquipmentModel.EquipmentType, c.EquipmentModel.LeftHandEquipmentPath),
                    Lower          = !string.IsNullOrEmpty(c.Lower) ? new Clothing(_content.Load <Texture2D>(c.Lower)) : null,
                    Upper          = !string.IsNullOrEmpty(c.Upper) ? new Clothing(_content.Load <Texture2D>(c.Upper)) : null,
                };

                position += new Vector2(200, 0);

                return(player);
            }).Cast <Actor>().ToList();

            var grassTexture = _content.Load <Texture2D>("Battle/Grasses/Grass");

            _background = new Sprite(grassTexture)
            {
                Position = new Vector2(grassTexture.Width / 2, grassTexture.Height / 2),
            };

            EnemyLoader eLoader = new EnemyLoader(_content);

            var enemies = eLoader.Load(EnemyLoader.Areas.CalmLands);

            var enemyPosition = new Vector2(200, 100);

            _actors.AddRange(enemies.Select(c =>
            {
                var enemy = new Enemy(_content, enemyPosition, _graphics.GraphicsDevice)
                {
                    ActorModel     = c,
                    LeftHandWeapon = GetWeapon(c.EquipmentModel.EquipmentType, c.EquipmentModel.LeftHandEquipmentPath),
                };
                enemyPosition += new Vector2(200, 0);

                return(enemy);
            }
                                            ).Cast <Actor>().ToList());

            _actors = _actors.OrderByDescending(c => c.ActorModel.Speed).ToList();

            _battleGUI = new BattleStateGUI(_gameModel);
            _battleGUI.SetAbilities(_actors.First().ActorModel);
            _battleGUI.SetTurns(_actors.Select(c => c.ActorModel).ToList());

            _chatBox = new ChatBox(_gameModel, _content.Load <SpriteFont>("Fonts/Font"));

            if (_conversation != null && _conversation.Count > 0)
            {
                _chatBox.Write(_conversation.First());
            }
        }
コード例 #2
0
 public override void UnloadContent()
 {
     _targets.Clear();
     _background = null;
     _actors.Clear();
     _battleGUI = null;
     _conversation.Clear();
     _chatBox = null;
 }
コード例 #3
0
ファイル: Game1.cs プロジェクト: Oyyou/Flounchy
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            _gameModel = new GameModel()
            {
                ContentManger         = Content,
                GraphicsDeviceManager = graphics,
                SpriteBatch           = spriteBatch,
            };

            var actors = new List <ActorModel>()
            {
                new ActorModel()
                {
                    Name      = "{TestA}",
                    Abilities = new AbilitiesModel()
                    {
                        Ability1 = new AbilityModel("Ability 1", "Battle/AbilityIcon", AbilityModel.TargetTypes.Single),
                        Ability2 = new AbilityModel("Ability 2", "Battle/AbilityIcon", AbilityModel.TargetTypes.Single),
                        Ability3 = new AbilityModel("Ability 3", "Battle/AbilityIcon", AbilityModel.TargetTypes.Single),
                        Ability4 = new AbilityModel("Ability 4", "Battle/AbilityIcon", AbilityModel.TargetTypes.All),
                    }
                },
                new ActorModel()
                {
                    Name      = "{TestB}",
                    Abilities = new AbilitiesModel()
                    {
                        Ability1 = new AbilityModel("Ability 1", "Battle/AbilityIcon", AbilityModel.TargetTypes.Single),
                        Ability2 = new AbilityModel("Ability 2", "Battle/AbilityIcon", AbilityModel.TargetTypes.Single),
                        Ability3 = new AbilityModel("Ability 3", "Battle/AbilityIcon", AbilityModel.TargetTypes.Single),
                        Ability4 = new AbilityModel("Ability 4", "Battle/AbilityIcon", AbilityModel.TargetTypes.All),
                    }
                },
            };

            UpdateWindowValues();

            _homeStateGUI = new HomeStateGUI(_gameModel, actors);

            _mainMenu = new MainMenuGUI(_gameModel);

            _battleGUI = new BattleStateGUI(_gameModel);

            _battleGUI.SetAbilities(actors.First());
        }