Inheritance: IBattleCharacter
示例#1
0
        // constructor
        public Battle(Game game, Texture2D bgTex, Song battleSong, Player p, Enemy e, bool run)
            : base(game)
        {
            StateManager.PushState(new LevelState(game, p));

            play = p;
            en = e;
            font = game.Content.Load<SpriteFont>("battle-font");
            tMenu = new TextMenu(font, choices);
            combatColor = new Texture2D(game.GraphicsDevice, 1, 1);
            combatColor.SetData<Color>(new Color[] { new Color(Color.Black, 150) });
            transparent = true;
            rgen = new Random();

            try
            {
                if (battleSong != null)
                {
                    MediaPlayer.Play(battleSong);
                    MediaPlayer.Volume = .5f;
                    MediaPlayer.IsRepeating = true;
                }
            }
            catch (Exception)
            {
            }

            canRun = run;

            backgroundTexture = bgTex;
            hasRun = false;
            currentItemCount = play.Items.Count;
            calculateSpeed();
        }
示例#2
0
        public override void Update(GameTime gameTime)
        {
            Enemy en = new Enemy(game.Content.Load<Texture2D>("ghostie"));
            Player pl = new Player(game, 0, 0);

            StateManager.PushState(new Battle(game, game.Content.Load<Texture2D>("test-battle-background"), null, pl, en, true));
        }
示例#3
0
 public Enemy Clone()
 {
     var enemy = new Enemy(enemyTexture);
     enemy.name = name;
     enemy.speed = speed;
     enemy.attack = attack;
     enemy.health = health;
     enemy.defense = defense;
     enemy.exp = exp;
     enemy.Items = items != null ? (Item[])items.Clone() : null;
     return enemy;
 }
示例#4
0
 private Enemy js_newEnemy(string textureName, string enemyName, double health,
     double attack, double defense, double speed, double exp, ArrayList items)
 {
     var enemy = new Enemy(game.Content.Load<Texture2D>(textureName));
     enemy.Name = enemyName;
     enemy.Health = (int)health;
     enemy.Speed = (int)speed;
     enemy.Attack = (int)attack;
     enemy.Defense = (int)defense;
     enemy.Exp = (int)exp;
     enemy.Items = createItemArray(items);
     return enemy;
 }
示例#5
0
 private void js_battle(Player player, Enemy enemy, string song)
 {
     StateManager.Running = false;
     int currentStackSize = StateManager.StackSize;
     Song battleSong = game.Content.Load<Song>(song);
     StateManager.PushState(new Battle(game, battleTexture, battleSong, player, enemy, false));
     StateManager.Running = true;
     while (currentStackSize != StateManager.StackSize && currentStackSize != 0)
     {
     }
     if (player.IsDead())
         Thread.CurrentThread.Abort();
 }
示例#6
0
 private void js_addRandomEncounter(Enemy enemy)
 {
     randomEncounters.Add(enemy);
 }