public GameWorld(Game game, ContentManager cm, Camera cam) : base(game) { content = cm; camera = cam; components = game.Components; physworld = new PhysicsWorld(game); modelmgr = new ModelManager(game, cam); level = new Level(); components.Add(physworld); components.Add(modelmgr); sfx = game.Content.Load<SoundEffect>(@"Audio/punch"); punch = sfx.CreateInstance(); punch.IsLooped = false; sfx = game.Content.Load<SoundEffect>(@"Audio/bgm"); bgm = sfx.CreateInstance(); bgm.IsLooped = true; bgm.Play(); }
public Enemy(Game game, Player player, Level level, GameObject body, GameObject fist, Vector3 pos) : base(game) { this.body = body; this.fist = fist; this.player = player; this.level = level; damage = 2; health = 10; fistX = 0; fistY = 0; fistZ = radius; //Attack parameters attackCooldown = 1f; //Time till enemy can attack again isAttacking = false; canAttack = true; enemyYaw = 0; fistDefaultAngle = 0.5f; angle = fistDefaultAngle; speed = (2 * MathHelper.Pi) * 2; //Set body GameObject parameters setPosition(pos); body.setPosition(position); body.physobj.coltype = PhysicsObject.ColliderType.enemy; //Set fist GameObject parameters fist.setScale(0.5f); fistPosition = new Vector3(fistX + body.physobj.position.X, fistY + body.physobj.position.Y, fistZ + body.physobj.position.Z); fist.setPosition(fistPosition); fist.physobj.coltype = PhysicsObject.ColliderType.enemy; prevFistPos = fistPosition; fist.physobj.isStatic = true; }