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; while (x >= tiles.Count) { tiles.Add(new List <Tile>()); } while (y >= tiles[x].Count) { tiles[x].Add(null); } tiles[x][y] = this; transform.localPosition = new Vector3(x, y, 0); gameObject.name = x.ToString("D3") + "x" + y.ToString("D3"); tileNum = eTileNum; if (tileNum == -1 && ShowMapOnCamera.S != null) { tileNum = ShowMapOnCamera.MAP[x, y]; if (tileNum == 0) { ShowMapOnCamera.PushTile(this); } } sprend.sprite = spriteArray[tileNum]; if (ShowMapOnCamera.S != null) { SetCollider(); } //TODO: Add something for destructibility - JB gameObject.SetActive(true); if (ShowMapOnCamera.S != null) { if (ShowMapOnCamera.MAP_TILES[x, y] != null) { if (ShowMapOnCamera.MAP_TILES[x, y] != this) { ShowMapOnCamera.PushTile(ShowMapOnCamera.MAP_TILES[x, y]); } } else { ShowMapOnCamera.MAP_TILES[x, y] = this; } } }
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"); gameObject.layer = 0; ///sets layer to default; tileNum = eTileNum; if (tileNum == -1 && ShowMapOnCamera.S != null) { tileNum = ShowMapOnCamera.MAP[x, y]; if (tileNum == 0) { ShowMapOnCamera.PushTile(this); } } sprend.sprite = spriteArray[tileNum]; if (ShowMapOnCamera.S != null) { Customize(); } //TODO: Add something for destructibility - JB gameObject.SetActive(true); if (ShowMapOnCamera.S != null) { if (ShowMapOnCamera.MAP_TILES[x, y] != null) { if (ShowMapOnCamera.MAP_TILES[x, y] != this) { ShowMapOnCamera.PushTile(ShowMapOnCamera.MAP_TILES[x, y]); } } else { ShowMapOnCamera.MAP_TILES[x, y] = this; } } }