public void OnTriggerExit2D(Collider2D other) { // if (other.GetComponent<TileInhabitant> () != null) { // Debug.LogError("otherexit: " + other.name); // toClear.TintColor = new Color (1f, 1f, 1f, 1f); // } ClearTilemapBehind tm = other.gameObject.GetComponentInParent <ClearTilemapBehind>(); if (tm != null) { tm.toClear.RemoveBehindLayer(collider); Debug.LogError("Xit : " + tm.name); } }
public void OnTriggerEnter2D(Collider2D other) { //This should be if it's a character, or if //it's a projectile // if (other.GetComponent<TileInhabitant> () != null) { // Debug.LogError("othere: " + other.name); // toClear.TintColor = new Color (1f, 1f, 1f, .5f); // } ClearTilemapBehind tm = other.gameObject.GetComponent <ClearTilemapBehind>(); if (tm != null) { tm.toClear.AddBehindLayer(collider); Debug.LogError("ENTER : " + tm.name); } }