public CTile(Vector2 atlasCoords, Vector2 mapCoords, string tileSet) { _tileBounds = atlasCoords; tileCoords = mapCoords; this.tileSet = tileSet; //if tileSet is null, we're probably in game if (tileSet != null) { _boundary = new Actors.Collision.CHitBox(null, mapCoords.X, mapCoords.Y, Graphics.CTextures.textures[tileSet].FrameWidth, Graphics.CTextures.textures[tileSet].FrameHeight); } }
public CTile(CTile copy) { this.tileCoords = copy.tileCoords; this.tileSet = copy.tileSet; this._tileBounds = copy._tileBounds; if (_boundary == null) { _boundary = new Actors.Collision.CHitBox(null, tileCoords.X, tileCoords.Y, Graphics.CTextures.textures[tileSet].FrameWidth, Graphics.CTextures.textures[tileSet].FrameHeight); } else { _dimensions = new Vector2(Graphics.CTextures.textures[tileSet].FrameWidth, Graphics.CTextures.textures[tileSet].FrameHeight); } }
//PARAMETERS //0: ChestType //1: ChestState //2: Item Inside public override void init(string name, Microsoft.Xna.Framework.Vector2 position, string dataType, int compAddress, params string[] additional) { short chestState, chestType, item; chestState = Convert.ToInt16(additional[0]); chestType = Convert.ToInt16(additional[1]); item = Convert.ToInt16(additional[2]); _chestState = (CHEST_STATES)chestState; _chestType = (CHEST_TYPES)chestType; _itemInside = (ITEMS_INSIDE)item; _imageIndex.Add(_CHESTS_SMALL, new Graphics.CSprite("tileset:items:chests-small")); _hitBox = new Collision.CHitBox(this, 0, 0, 16, 16); _openBox = new Collision.CHitBox(this, 0, 16, 16, 16); switch (_chestType) { case CHEST_TYPES.BIG_CHEST: break; case CHEST_TYPES.SMALL_CHEST: swapImage(_CHESTS_SMALL); if (_chestState == CHEST_STATES.LOCKED) { image.setFrame(0, 0); } else if (_chestState == CHEST_STATES.UNLOCKED) { image.setFrame(0, 1); } break; } base.init(name, position, dataType, compAddress, additional); }
public void Dispose() { _boundary = null; }