示例#1
0
        /// <summary>
        /// Constructs a new gem.
        /// </summary>
        public Gem(Engine level, Vector2 position)
        {
            this.level = level;
            this.basePosition = position;

            LoadContent();
        }
示例#2
0
        public TileBomb(Engine engine, Vector2 startingPos, int movement)
            : base(engine)
        {
            Movement = movement;
            Position = startingPos;

            Hit = false;
        }
示例#3
0
        public Bullet(Engine engine, Vector2 startingPos, double rotation, string source)
            : base(CollisionCheckType.Rectangle,engine)
        {
            Rotation = rotation;
            Position = startingPos;
            Source = source;

            //LoadContent(_engine.Content);
        }
示例#4
0
 protected GameObject(Engine engine)
 {
     _engine = engine;
     if (_engine.IsInDebugMode)
     {
         _debugTex = new Texture2D(_engine.GraphicsDevice, 1, 1);
         _debugTex.SetData(new[] {Color.Red});
     }
 }
示例#5
0
        public Crosshair(Engine engine)
        {
            _engine = engine;

            _engine.Camera.CameraMoved += HandleCameraMoved;

            _position = _engine.Camera.Position;

            var center = _engine.Camera.ScreenCenter;

            Mouse.SetPosition((int)center.X, (int)center.Y);

            _initialState = Mouse.GetState();
        }
示例#6
0
 /// <summary>
 /// Constructs a new tile.
 /// </summary>
 protected Tile(string texture, Vector2 position, TileCollision collision, Engine engine)
     : base(engine)
 {
     Name = texture;
     Position = position;
     Collision = collision;
 }
 public DestructableObject(string texture, Vector2 position, CollisionCheckType collisionCheck, Engine engine)
     : base(collisionCheck, engine)
 {
     _textureName = texture;
     Position = position;
 }
 public DestructableObject(string texture, Vector2 position, Engine engine)
     : this(texture, position,CollisionCheckType.Rectangle,engine)
 {
 }
        /// <summary>
        /// Load graphics content for the game.
        /// </summary>
        public override void LoadContent()
        {
            if (content == null)
                content = new ContentManager(ScreenManager.Game.Services, "Content");

            _background = content.Load<Texture2D>("Backgrounds/sunset");

            _particleEngine = new ParticleEngine(content);

            _gameEngine = new Engine(ScreenManager.Game.Services, _particleEngine)
                {
                    GraphicsDevice = ScreenManager.GraphicsDevice
                };

            _camera = new Camera2D(ScreenManager.Game, _gameEngine);

            _hud = new HUD(_camera);

            // Load the level.
            string levelPath = string.Format("Content/Levels/{0}.txt", 0);
            using (Stream fileStream = TitleContainer.OpenStream(levelPath))
            {
                _gameEngine.Initialize(fileStream, _camera, _hud);

                _camera.Focus = _gameEngine.Player;

                _hud.Initialize(content);

                //todo: implement video setting for postprocessing
                _postprocessor = new GraphicalPostprocessor(true);
                _postprocessor.Initialize(ScreenManager.Game);
            }

            // once the load has finished, we use ResetElapsedTime to tell the game's
            // timing mechanism that we have just finished a very long frame, and that
            // it should not try to catch up.
            ScreenManager.Game.ResetElapsedTime();
        }
示例#10
0
        public Level(Engine engine)
        {
            _engine = engine;

            ExitPosition = InvalidPosition;
        }
示例#11
0
 public DestructableTile(int life, string name, Vector2 position, TileCollision collision, Engine engine)
     : base(name, position, collision, engine)
 {
     _life = life;
 }
 protected AIControllableObject(Engine engine)
     : this(CollisionCheckType.Rectangle, engine)
 {
 }
示例#13
0
 public EvilBug(Engine engine)
     : base(engine)
 {
 }
 protected CollidableGameObject(CollisionCheckType collisionCheck,Engine engine)
     : base(engine)
 {
     CollCheckLevel = collisionCheck;
 }
 protected CollidableGameObject(Engine engine)
     : this(CollisionCheckType.Rectangle,engine)
 {
 }
示例#16
0
 /// <summary>
 /// Constructors a new player.
 /// </summary>
 public Player(Engine engine, Vector2 position)
     : base(engine)
 {
     //LoadContent(engine.Content);
     Reset(position);
 }
示例#17
0
 public EvilBug(CollisionCheckType collisionCheck, Engine engine)
     : base(collisionCheck, engine)
 {
 }
示例#18
0
 public GroundTile(string name, Vector2 position, TileCollision collision, Engine engine)
     : base(name, position, collision, engine)
 {
 }
示例#19
0
        public Camera2D(Game game, Engine engine)
            : base(game)
        {
            game.Components.Add(this);

            _engine = engine;

            _titleSafeArea = new Vector2();
        }
 protected AIControllableObject(CollisionCheckType collisionCheck, Engine engine)
     : base(collisionCheck, engine)
 {
 }
示例#21
0
 public Enemy(Engine engine, Vector2 pos)
     : base(engine)
 {
     Position = pos;
 }