예제 #1
0
        public Player(Texture2D texture, TileMap map, SceneObjectHandler objectHandler, GameOverlay overlay)
        {
            this.texture       = texture;
            position           = map.GetSpawn();
            this.map           = map;
            this.objectHandler = objectHandler;
            this.overlay       = overlay;

            dimensions       = new Vector2(texture.Width, texture.Height);
            collisionManager = new EntityCollisionHandler(this.map);
            inputManager     = new PlayerInputHandler();
            physicsManager   = new PhysicsHandler(collisionManager);
            heldItemManager  = new HeldItemHandler(map);
        }
예제 #2
0
        protected override void Initialize()
        {
            base.Initialize();
            gameOverlay = new GameOverlay(textureHandler);
            gameOverlay.Initialize();

            tileMap            = new TileMap(textureHandler.tileMapTexture);
            camera             = new Camera(GraphicsDevice.Viewport, tileMap);
            sceneObjectHandler = new SceneObjectHandler(tileMap);
            player             = new Player(textureHandler.playerTexture, tileMap, sceneObjectHandler, gameOverlay);

            enemies = new List <Enemy>();
            List <Vector2> enemySpawns = tileMap.GetEnemySpawns();

            foreach (Vector2 pos in enemySpawns)
            {
                enemies.Add(new Enemy(pos, textureHandler.enemyTexture, tileMap));
            }

            sceneObjectHandler.AddObject(new Pickup_Ranged(tileMap.GetPXPosition(new Vector2(3, 3)), textureHandler.gunTexture, textureHandler.bulletTexture, textureHandler.tempGun, 20.0f, 20.0f, 6));
            sceneObjectHandler.AddObject(new Pickup_Melee(tileMap.GetPXPosition(new Vector2(5, 3)), textureHandler.healthTexture, textureHandler.swordTexture, 20.0f, 15f, Pickup_Melee.AttackType.SWING));
            sceneObjectHandler.AddObject(new Pickup_Melee(tileMap.GetPXPosition(new Vector2(5, 5)), textureHandler.no_imageTexture, textureHandler.swordTexture, 20.0f, 15f, Pickup_Melee.AttackType.STAB));
            sceneObjectHandler.AddObject(new StatBoost(tileMap.GetPXPosition(new Vector2(7, 3)), textureHandler.speedTexture, 1.5f, StatBoost.StatType.SPEED));
        }