Ejemplo n.º 1
0
        public GameLevel(Camera camera, SpriteBatch spriteBatch, World world, bool visible)
        {
            _objects = new List <GameObject>();
            _sorted  = true;

            _joints = new List <Joint>();

            _world = world;

            _camera      = camera;
            _spriteBatch = spriteBatch;

            _background = new ParallaxBackground(_world, _camera, _spriteBatch);

            Enabled = true;
            Visible = visible;
        }
        /// <param name="parent">Родительский элемент - фон.</param>
        /// <param name="sprite">Спрайт.</param>
        /// <param name="parallaxSpeed">Скорость параллакса. (1.0f, 1.0f), если параллакса нет.</param>
        /// <param name="layer">Слой.</param>
        /// <param name="defaultSize">true, если принимать размер текстуры за размер объекта.</param>
        protected ParallaxBackgroundItem(ParallaxBackground parent, Sprite sprite, Vector2 parallaxSpeed, int layer, Vector2 position, bool defaultSize)
        {
            this._parallaxBackground = parent;
            this._sprite             = sprite;
            this.ParallaxSpeed       = parallaxSpeed;
            this.DrawOrder           = layer;
            this._camera             = parent.Camera;
            this._spriteBatch        = parent.SpriteBatch;
            this._position           = position;
            this._rotation           = 0f;

            if (defaultSize)
            {
                //По умолчанию размер равен размеру текстуры в SimUnits
                Size = ConvertUnits.ToSimUnits(sprite.Texture.Width, sprite.Texture.Height);
            }

            Visible = true;
        }
 public ParallaxBackgroundItem(ParallaxBackground parent, Sprite sprite, float xParallaxSpeed, int layer, Vector2 position, Vector2 size, float rotation)
     : this(parent, sprite, new Vector2(xParallaxSpeed, 1.0f), layer, position, size, rotation)
 {
 }
 public ParallaxBackgroundItem(ParallaxBackground parent, Sprite sprite, float xParallaxSpeed, int layer)
     : this(parent, sprite, new Vector2(xParallaxSpeed, 1.0f), layer, Vector2.Zero)
 {
 }
 public ParallaxBackgroundItem(ParallaxBackground parent, Sprite sprite, Vector2 parallaxSpeed, int layer, Vector2 position, Vector2 size, float rotation)
     : this(parent, sprite, parallaxSpeed, layer, position, size)
 {
     this._rotation = rotation;
 }
 public ParallaxBackgroundItem(ParallaxBackground parent, Sprite sprite, Vector2 parallaxSpeed, int layer, Vector2 position, Vector2 size)
     : this(parent, sprite, parallaxSpeed, layer, position, false)
 {
     Size = size;
 }
 public ParallaxBackgroundItem(ParallaxBackground parent, Sprite sprite, Vector2 parallaxSpeed, int layer, Vector2 position)
     : this(parent, sprite, parallaxSpeed, layer, position, true)
 {
 }
Ejemplo n.º 8
0
 public ParallaxBackgroundDynamicItem(ParallaxBackground parent, float angularVelocity, float angularDamping, Vector2 linearVelocity, float linearDamping, Sprite sprite, Vector2 parallaxSpeed, int layer, Vector2 position, Vector2 size, float rotation)
     : base(parent, sprite, parallaxSpeed, layer, position, size, rotation)
 {
     _world = parent.World;
     CreateBody(position, angularVelocity, angularDamping, linearVelocity, linearDamping);
 }
Ejemplo n.º 9
0
 public ParallaxBackgroundDynamicItem(ParallaxBackground parent, float angularVelocity, float angularDamping, Vector2 linearVelocity, float linearDamping, Sprite sprite, float xParallaxSpeed, int layer, Vector2 position, Vector2 size, float rotation)
     : this(parent, angularVelocity, angularDamping, linearVelocity, linearDamping, sprite, new Vector2(xParallaxSpeed, 1.0f), layer, position, size, rotation)
 {
 }