public void SetLightOfTile(IntVector2 pos, LightAmount amount) { realData[pos.x, pos.y].light = amount; realData[pos.x, pos.y].prefab.GetComponent <Lightable>().UpdateLight(amount, true); if (realData[pos.x, pos.y].occupant) { realData[pos.x, pos.y].occupant.GetComponent <Lightable>().UpdateLight(amount, true); } }
public void UpdateLight(LightAmount l, bool andChildrenLight) { if (andChildrenLight == true) { foreach (Lightable c in children) { c.UpdateLight(l, andChildrenLight); } } if (mr == null) { return; } Color newColor = Color.black; mr.enabled = true; if (l == LightAmount.black) { newColor = Color.black; mr.enabled = false; } else if (l == LightAmount.revealed) { newColor = originalColor * .2f; } else if (l == LightAmount.litOutskirts) { newColor = originalColor * .5f; } else if (l == LightAmount.lit) { newColor = originalColor; } //StartCoroutine(SmoothGoBetweenColors(mr.material.color ,newColor)); mr.material.color = newColor; }