public GameObject(Vector2 spritePosition, string textureName, DrawManager.Layer drawLayer = DrawManager.Layer.Playground, int spriteWidth = 0, int spriteHeight = 0) { Tuple <Texture, List <Animation> > ss = GfxManager.GetSpritesheet(textureName); texture = ss.Item1; animations = ss.Item2; Animation = animations[0]; //texture = GfxManager.GetTexture(textureName); if (texture == null) { texture = GfxManager.GetSpritesheet(textureName).Item1; } sprite = new Sprite(Animation.FrameWidth > 0 ? Animation.FrameWidth : texture.Width, Animation.FrameHeight > 0 ? Animation.FrameHeight : texture.Height); //texture = GfxManager.GetTexture(textureName); sprite = new Sprite(spriteWidth > 0 ? spriteWidth : texture.Width, spriteHeight > 0 ? spriteHeight : texture.Height); sprite.pivot = new Vector2(sprite.Width / 2, sprite.Height / 2); sprite.position = spritePosition; layer = drawLayer; IsActive = true; UpdateManager.AddItem(this); DrawManager.AddItem(this); }
public GameObject(Vector2 spritePosition, string textureName, DrawManager.Layer drawLayer = DrawManager.Layer.Playground, int spriteWidth = 0, int spriteHeight = 0) { texture = GfxManager.GetTexture(textureName); sprite = new Sprite(spriteWidth > 0 ? spriteWidth : texture.Width, spriteHeight > 0 ? spriteHeight : texture.Height); sprite.pivot = new Vector2(sprite.Width / 2, sprite.Height / 2); sprite.position = spritePosition; layer = drawLayer; IsActive = true; UpdateManager.AddItem(this); DrawManager.AddItem(this); }