/// <summary> /// Create a 2D sprite using the sprite sheet and a sprite name. /// It will use the TextureManager to get a rectangle for the sprite's location on the sheet. /// </summary> /// <param name="spriteSheet"></param> /// <param name="sprite"></param> public Sprite2D(Texture2D spriteSheet, TextureManager.DUNGEON_SPRITES sprite, int screenXPos, int screenYPos) { texture = spriteSheet; position = new Vector2(screenXPos, screenYPos); spriteRect = TextureManager.getRoomSpriteRect(sprite); colour = Color.White; rotation = 0f; origin = new Vector2(0f); scale = new Vector2(Config.screenScale); effect = SpriteEffects.None; layerDepth = 0f; }
/// <summary> /// Create a 2D sprite using the sprite sheet and a sprite name. /// It will use the TextureManager to get a rectangle for the sprite's location on the sheet. /// </summary> /// <param name="spriteSheet"></param> /// <param name="sprite"></param> public SpriteAnimated2D(Texture2D spriteSheet, TextureManager.DUNGEON_SPRITES[] enumSprites, int screenXPos, int screenYPos) { texture = spriteSheet; position = new Vector2(screenXPos, screenYPos); sprites = enumSprites; colour = Color.White; rotation = 0f; origin = new Vector2(0f); scale = new Vector2(Config.screenScale); effect = SpriteEffects.None; layerDepth = 0f; totalFrames = enumSprites.Length-1; curFrame = 0; spriteRect = TextureManager.getRoomSpriteRect(sprites[0]); }
public RoomObjectButton(String name, TextureManager.DUNGEON_SPRITES buttonSprite, int x, int y) : base(name, buttonSprite, x, y) { switch (buttonSprite) { case TextureManager.DUNGEON_SPRITES.BUTTON_1: case TextureManager.DUNGEON_SPRITES.BUTTON_2: case TextureManager.DUNGEON_SPRITES.BUTTON_3: case TextureManager.DUNGEON_SPRITES.BUTTON_4: case TextureManager.DUNGEON_SPRITES.BUTTON_5: break; default: new Exception("Must give a button sprite!"); break; } }
/// <summary> /// Changes the current sprite to the one given using the TextureManager. /// </summary> /// <param name="sprite">Sprite name</param> public void setSprite(TextureManager.DUNGEON_SPRITES sprite) { spriteRect = TextureManager.getRoomSpriteRect(sprite); }
/// <summary> /// Sets the background of the Room to an enum DUNGEON_SPRITES 2D array. /// </summary> /// <param name="textureArray"></param> public void setBackgroundTexture(TextureManager.DUNGEON_SPRITES[,] textureArray) { TextureBG = textureArray; }