using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class Pixel : MonoBehaviour { public int x; public int y; public float randomTime; public RawImage self_; public Sprite highLight; private bool isAlive = true; public void disappearPixel() { if (randomTime <= 0 && isAlive) { self_.texture = highLight.texture; //Destroy(self_, 1f); isAlive = false; } else randomTime -= Time.deltaTime; if (!isAlive && randomTime > -1f) { self_.color = new Vector4(1f, 1f, 1f, 1f + randomTime); } else if (!isAlive && randomTime <= -1f) { self_.color = new Vector4(1f, 1f, 1f, 0f); } } }