Ejemplo n.º 1
0
        public virtual void Draw(GameTime gameTime, SpriteBatch spriteBatch)
        {
            if (_IsVisible)
            {
                ICutlassTexture texture = TextureManager.GetTexture(_SceneryObject_Id);

                spriteBatch.Draw(texture.BaseTexture, CurrentFrameBoundingRect.Min, texture.AreaToRender, Color.White);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Get a Texture2D
        /// </summary>
        /// <param name="textureName"></param>
        /// <returns></returns>
        public static Texture2D GetTexture2D(TexId textureId)
        {
            ICutlassTexture texture = GetTexture(textureId);

            if (texture != null)
            {
                return(texture.BaseTexture);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Add a texture of type CutlassTexture. Returns the id of the new texture
        /// </summary>
        /// <param name="newTexture"></param>
        /// <param name="textureName"></param>
        public static TexId AddTexture(ICutlassTexture newTexture)
        {
            TexId texId;

            lock (_TexIdLock)
            {
                texId = _NextTexId++;
            }

            _Textures.Add(texId, newTexture);

            if (_Initialized)
                newTexture.LoadContent();

            return texId;
        }
Ejemplo n.º 4
0
        public Scenery(Vector2 position, bool isVisible = true, ICutlassTexture texture = null, bool animated = false, CollisionSide side = CollisionSide.All)
        {
            _Position = position;
            _IsVisible = isVisible;
            _Active = true;

            if (isVisible && texture != null)
            {
                _SceneryObject_Id = TextureManager.AddTexture(texture);
                _Animated = animated;
                _Side = side;
            }
            else
            {
                _Side = CollisionSide.All;
            }
        }
Ejemplo n.º 5
0
        public Scenery(Vector2 position, bool isVisible = true, ICutlassTexture texture = null, bool animated = false, CollisionSide side = CollisionSide.All)
        {
            _Position  = position;
            _IsVisible = isVisible;
            _Active    = true;

            if (isVisible && texture != null)
            {
                _SceneryObject_Id = TextureManager.AddTexture(texture);
                _Animated         = animated;
                _Side             = side;
            }
            else
            {
                _Side = CollisionSide.All;
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Add a texture of type CutlassTexture. Returns the id of the new texture
        /// </summary>
        /// <param name="newTexture"></param>
        /// <param name="textureName"></param>
        public static TexId AddTexture(ICutlassTexture newTexture)
        {
            TexId texId;

            lock (_TexIdLock)
            {
                texId = _NextTexId++;
            }

            _Textures.Add(texId, newTexture);

            if (_Initialized)
            {
                newTexture.LoadContent();
            }

            return(texId);
        }
Ejemplo n.º 7
0
        public void Draw(GameTime gameTime, SpriteBatch spriteBatch)
        {
            ICutlassTexture texture = (ICutlassTexture)TextureManager.GetTexture(_CurrentTexture);

            spriteBatch.Draw(texture.BaseTexture, _Position, texture.AreaToRender, Color.White, _Rotation, new Vector2(texture.AreaToRender.Width / 2, texture.AreaToRender.Height / 2), _Scale, SpriteEffects.None, 1);
        }