public static Bot CreateBot(BotInfo info, List <Vector> patrolPoints) { var position = info.Position.Copy(); var angle = info.Angle; var type = BotBank.GetBotTypeInfo(info.Type); var legs = new PlayerBodySprite(position, GetBitmap(type.ClothesTileMapPath), 1, 14, 27, new Size(64, 64)); var torso = new StaticSprite(GetBitmap(type.WeaponsTileMapPath), WeaponFramesId[type.Weapon.WeaponType], new Size(79, 57)); var legsContainer = new SpriteContainer(legs, position, angle); var torsoContainer = new SpriteContainer(torso, position, angle); var sightVector = new Vector(1, 0).Rotate(-angle, Vector.ZeroVector).Normalize(); return(new Bot( type.Health, type.Armor, legsContainer, torsoContainer, sightVector, new RigidCircle(position, 32, false, true), AbstractWeaponFactory.CreateGun(type.Weapon), type.DeadBodyTileMapPath, patrolPoints)); }
public static void SpawnBots( List <Vector> spawnPositions, Vector playerPosition, List <Bot> levelBots, List <SpriteContainer> levelSprites, List <RigidShape> levelDynamicShapes, List <Vector> patrolPoints) { var xAxisVector = new Vector(1, 0); foreach (var position in spawnPositions) { var angle = Vector.GetAngle(xAxisVector, playerPosition - position); var newBot = EntityFactory.CreateBot(new EntityFactory.BotInfo(position, angle, BotBank.GetRandomBotType()), patrolPoints); levelBots.Add(newBot); levelDynamicShapes.Add(newBot.CollisionShape); levelSprites.Add(newBot.LegsContainer); levelSprites.Add(newBot.TorsoContainer); } }