public void Dehighlight() { if (!isSelected) { HighlightTilemap.SetTile(LocalPlace, null); } }
public void Highlight(Tile hightlightTile) { if (!isSelected) { HighlightTilemap.SetTile(LocalPlace, hightlightTile); } }
// Awake is called when the script is loaded, before Start. We initialize the piece here. public void Awake() { // Initialize all local object references. shadow = transform.GetChild(0).gameObject; glow = transform.GetChild(1).gameObject; glowSpriteRenderer = glow.GetComponent <SpriteRenderer>(); body = transform.GetChild(2).gameObject; audioSource = transform.GetChild(3).GetComponent <AudioSource>(); // Initialize all world object references. gameController = GameObject.Find("/GameController").GetComponent <GameController>(); highlightTilemap = GameObject.Find("/Grid/Highlight Tilemap").GetComponent <HighlightTilemap>(); // Not glowing initially glow.SetActive(false); }
public void Select(Tile selectedTile) { isSelected = true; HighlightTilemap.SetTile(LocalPlace, selectedTile); }
public void Deselect() { isSelected = false; HighlightTilemap.SetTile(LocalPlace, null); }
private void Awake() { audioSource = GetComponent <AudioSource>(); highlightTilemap = GameObject.Find("/Grid/Highlight Tilemap").GetComponent <HighlightTilemap>(); }