public MonstersManager(Game1 game) : base(game) { monsters = new List<Monster>(); myGame = game; rnd = new Random(); hpBillBoardSystem = new HPBillboardSystem(game.GraphicsDevice, game.Content, Constants.HP_SIZE, monsters); //skinnedModel = Game.Content.Load<SkinnedModel>(@"Textures\EnemyBeast"); skinnedModel = Game.Content.Load<SkinnedModel>(@"model\EnemyBeast"); }
public MonstersManager(Game1 game) : base(game) { monsters = new List <Monster>(); myGame = game; rnd = new Random(); hpBillBoardSystem = new HPBillboardSystem(game.GraphicsDevice, game.Content, Constants.HP_SIZE, monsters); //skinnedModel = Game.Content.Load<SkinnedModel>(@"Textures\EnemyBeast"); skinnedModel = Game.Content.Load <SkinnedModel>(@"model\EnemyBeast"); }
public MonstersManager(MyGame game) : base(game) { monsters = new List<Monster>(); deadMonsters = new List<Monster>(); myGame = game; rnd[0] = new Random(); rnd[1] = new Random(); hpBillBoardSystem = new HPBillboardSystem(game.GraphicsDevice, game.Content, Constants.HP_SIZE, monsters); //skinnedModel = Game.Content.Load<SkinnedModel>(@"Textures\EnemyBeast"); reinitializeMonstersTypes(); myGame.mediator.register(this, MyEvent.G_NextLevel_END_OF_MUSIC); }
private void addEnemy() { float x = 0, z = 0; float y = Constants.TERRAIN_HEIGHT; //while(y > .5 * Constants.TERRAIN_HEIGHT) //{ bool flag = true; while (flag) { x = (float)(rnd[0].NextDouble() * Constants.FIELD_MAX_X_Z * 2 - Constants.FIELD_MAX_X_Z); z = (float)(rnd[0].NextDouble() * Constants.FIELD_MAX_X_Z * 2 - Constants.FIELD_MAX_X_Z); //x = (float)(rnd[0].NextDouble() * 50); //z = (float)(rnd[0].NextDouble() * 50); if (Math.Abs(x - myGame.player.unit.position.X) > 20 && Math.Abs(z - myGame.player.unit.position.Z) > 20) { flag = false; } } y = myGame.GetHeightAtPosition(x, z); //} Vector3 pos = new Vector3(x, y, z); Vector3 rot = new Vector3(0, (float)(rnd[0].NextDouble() * MathHelper.TwoPi), 0); int choice = (int)(rnd[1].NextDouble() * 4); MonsterUnit monsterUnit = new MonsterUnit(myGame, pos, rot, Constants.MONSTER_SCALE, monsterConstants[choice]); Monster monster; //if(deadMonsters.Count == 0) monster = new Monster(myGame, new MonsterModel(myGame, skinnedModel[choice]), monsterUnit); //else //{ // monster = deadMonsters[0]; // deadMonsters.RemoveAt(0); // monster.monsterUnit = monsterUnit; // monster.unit = monsterUnit; // monster.health = 100; // ((MonsterModel)monster.cModel).reinitialize(skinnedModel[choice]); //} monsters.Add(monster); hpBillBoardSystem.monstersTextures.Add(HPBillboardSystem.getTexture(monster.health)); //billBoardSystem.monsters.Add(monster); }
public MonstersManager(MyGame game) : base(game) { monsters = new List <Monster>(); deadMonsters = new List <Monster>(); myGame = game; rnd[0] = new Random(); rnd[1] = new Random(); hpBillBoardSystem = new HPBillboardSystem(game.GraphicsDevice, game.Content, Constants.HP_SIZE, monsters); //skinnedModel = Game.Content.Load<SkinnedModel>(@"Textures\EnemyBeast"); reinitializeMonstersTypes(); myGame.mediator.register(this, MyEvent.G_NextLevel_END_OF_MUSIC); }
private void addEnemy() { float x = 0, z = 0; float y = Constants.TERRAIN_HEIGHT; //while(y > .5 * Constants.TERRAIN_HEIGHT) //{ x = (float)(rnd.NextDouble() * Constants.FIELD_MAX_X_Z * 2 - Constants.FIELD_MAX_X_Z); z = (float)(rnd.NextDouble() * Constants.FIELD_MAX_X_Z * 2 - Constants.FIELD_MAX_X_Z); y = myGame.GetHeightAtPosition(x, z); //} Vector3 pos = new Vector3(x, y, z); Vector3 rot = new Vector3(0, (float)(rnd.NextDouble() * MathHelper.TwoPi), 0); MonsterUnit monsterUnit = new MonsterUnit(myGame, pos, rot, Constants.MONSTER_SCALE); Monster monster = new Monster(myGame, skinnedModel, monsterUnit); monsters.Add(monster); hpBillBoardSystem.monstersTextures.Add(HPBillboardSystem.getTexture(monster.health)); //billBoardSystem.monsters.Add(monster); }
private void DrawHP() { Rectangle rect = new Rectangle(0, 0, 300, 50); spriteBatch.Draw(HPBillboardSystem.getTexture(health), rect, Color.White); }