public GameObject(Vector2 spritePosition, string spritesheetName, DrawManager.Layer drawLayer = DrawManager.Layer.Playground) { Tuple <Texture, List <Animation> > spritesheet = GfxManager.GetSpritesheet(spritesheetName); texture = spritesheet.Item1; Animations = spritesheet.Item2; Animation = Animations[0]; sprite = new Sprite(Animation.FrameWidth, Animation.FrameHeight) { position = spritePosition }; /*texture = GfxManager.GetTexture(textureName); * sprite = new Sprite(spriteWidth > 0 ? spriteWidth : texture.Width, spriteHeight > 0 ? spriteHeight : texture.Height) * { * position = spritePosition * };*/ layer = drawLayer; IsActive = true; UpdateManager.AddItem(this); DrawManager.AddItem(this); //Animation = new Animation((int)sprite.Width, (int)sprite.Height, cols, rows, fps, loop); }
public Bar(Vector2 position, string textureName = "playerBar", float maxValue = 100, int height = 0) : base(position, textureName, DrawManager.Layer.GUI) { barWidth = texture.Width; value = MaxValue = maxValue; frameTexture = GfxManager.GetSpritesheet("barFrame").Item1; frame = new Sprite(frameTexture.Width, frameTexture.Height) { position = position }; }