public void Shoot(Vector2 location, Vector2 velocity) { Bullet bullet = new Bullet(actorManager, particleManager, tileMap, camera, location, velocity * this.step, memento, content, collideWidth, collideHeight, collideWidth, collideHeight); bullets.Add(bullet); actorManager.AddMapObject(bullet); }
void NewMapHandling(object sender, EventArgs e) { //TODO: Get weapons by map actors weaponManager.AddWeapon(new Actors.Weapons.Pistol(actorManager, particleManager, tileMap, camera, content)); actorManager.Reset(); List <Vector2> playerLocations = tileMap.GetLocationOfCodeValue("player"); if (playerLocations.Count > 0) { foreach (Vector2 playerLocation in playerLocations) { player = new Actors.Player(actorManager, tileMap, camera, playerLocation + new Vector2(16, 16), content.Load <Texture2D>(@"Textures/player"), 25.0f, 16, 16, 15, 15); player.WeaponManager = this.weaponManager; actorManager.AddPlayer(player); } } else { player = new Actors.Player(actorManager, tileMap, camera, new Vector2(16, 16), content.Load <Texture2D>(@"Textures/player"), 25.0f, 16, 16, 15, 15); player.WeaponManager = this.weaponManager; actorManager.AddPlayer(player); } this.player = actorManager.GetNextPlayer(); List <Vector2> mobLocations = tileMap.GetLocationOfCodeValue("mob"); foreach (Vector2 mobLocation in mobLocations) { Actors.Mobs.Chaser chaser = new Actors.Mobs.Chaser(actorManager, particleManager, tileMap, camera, mobLocation + new Vector2(16, 16), content, 30, 30, 30, 30); chaser.ChaseTarget = this.player; actorManager.AddMapObject(chaser); } Dictionary <Vector2, int> actors = tileMap.GetActorsLocationAndID(); foreach (KeyValuePair <Vector2, int> actor in actors) { StaticObject obj; if (actor.Value <= gateMapper.LastGateID) { obj = new Gate(this.tileMap, this.camera, actor.Key, gateMapper.GetTextureByID(actor.Value), tileMap.SourceTileWidth, tileMap.SourceTileHeight, gateMapper.GetTagByID(actor.Value), gateMapper.IsGateEnabled(actor.Value)); } else if (actor.Value == gateMapper.CoinID) { obj = new Coin(this.tileMap, this.camera, actor.Key, gateMapper.GetTextureByID(actor.Value), tileMap.SourceTileWidth, tileMap.SourceTileHeight, gateMapper.GetTagByID(actor.Value)); } else if (actor.Value == gateMapper.HiddenWallID) { obj = new HiddenWall(this.tileMap, this.camera, actor.Key, gateMapper.GetTextureByID(actor.Value), tileMap.SourceTileWidth, tileMap.SourceTileHeight, gateMapper.GetTagByID(actor.Value)); } else if (actor.Value == gateMapper.CloneBoxID) { obj = new CloneBox(this.actorManager, this.particleManager, this.tileMap, this.camera, actor.Key, gateMapper.GetTextureByID(actor.Value), content, tileMap.SourceTileWidth, tileMap.SourceTileHeight, gateMapper.GetTagByID(actor.Value)); } else { obj = new Button(this.tileMap, this.camera, actor.Key, gateMapper.GetTextureByID(actor.Value), tileMap.SourceTileWidth, tileMap.SourceTileHeight, gateMapper.GetTagByID(actor.Value)); } obj.CollisionRectangle = gateMapper.GetCollisionRectangleByID(actor.Value, actor.Key); obj.InteractionRectangle = gateMapper.GetInteractionRectangleByID(actor.Value, actor.Key); actorManager.AddStaticObject(obj); } }