Пример #1
0
        private void OnContact(object sender, ContactEventArgs e)
        {
            //Temp bool statements for sprint 4 - 1 object is enemy && other is not player or level block. Fix on refactor.
            bool obj1IsEnemyNoPlayer = e.Object1.UserData is Kritter && !(e.Object2.UserData is Player || e.Object2.UserData is LevelBlock);
            bool obj2IsEnemyNoPlayer = !(e.Object1.UserData is Player || e.Object1.UserData is LevelBlock) && e.Object2.UserData is Kritter;

            if (obj1IsEnemyNoPlayer || obj2IsEnemyNoPlayer)
            {
                EnemyCollisionHandler.CollisionResponse(e.Object1.UserData as IGameObject, e.Object2.UserData as IGameObject, e.Side);
            }
        }
Пример #2
0
 /*
  * LoadContent will be called once per game and is the place to load
  * all of your content.
  */
 protected override void LoadContent()
 {
     // Create a new SpriteBatch, which can be used to draw textures.
     spriteBatch = new SpriteBatch(GraphicsDevice);
     SoundPool.LoadContent(Content);
     EnemySpriteFactory.Instance.LoadAllTextures(Content);
     ItemSpriteFactory.Instance.LoadAllTextures(Content);
     PlayerSpriteFactory.Instance.LoadAllTextures(Content);
     FontFactory.Instance.LoadAllFonts(Content);
     WorldManager.Instance.LoadAllGameObjects();
     PlayerCollisionHandler.LoadCollisionResponseTable();
     EnemyCollisionHandler.LoadCollisionResponseTable();
 }