void Awake() { S = this; SSF = (float)ss; float texScale = 1.0f / SSF; TEX_SCALE = Vector2.one * texScale; SPRITE_SHEET_W = mapSprites.width / ss; }
public void SetTile(int eX, int eY, int eTileNum = -1) { if (x == eX && y == eY) { return; // Don't move this if you don't have to. - JB } x = eX; y = eY; transform.localPosition = new Vector3(x, y, 0); gameObject.name = x.ToString("D3") + "x" + y.ToString("D3"); tileNum = eTileNum; if (tileNum == -1 && ShowMapOnCamera_custom.S != null) { tileNum = ShowMapOnCamera_custom.MAP[x, y]; if (tileNum == 0) { ShowMapOnCamera_custom.PushTile(this); } } sprend.sprite = spriteArray[tileNum]; if (ShowMapOnCamera_custom.S != null) { SetCollider(); } //TODO: Add something for destructibility - JB gameObject.SetActive(true); if (ShowMapOnCamera_custom.S != null) { if (ShowMapOnCamera_custom.MAP_TILES[x, y] != null) { if (ShowMapOnCamera_custom.MAP_TILES[x, y] != this) { ShowMapOnCamera_custom.PushTile(ShowMapOnCamera_custom.MAP_TILES[x, y]); } } else { ShowMapOnCamera_custom.MAP_TILES[x, y] = this; } } }