You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
821 B
33 lines
821 B
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); |
|
} |
|
|
|
|
|
} |
|
}
|
|
|