1
Fork 0
mirror of https://github.com/Steffo99/gravity-fusion.git synced 2024-11-22 00:14:18 +00:00

Use a gradient for the color change

This commit is contained in:
Steffo 2019-10-05 13:30:09 +02:00
parent 005229e2c3
commit aef8b147be
2 changed files with 32 additions and 2 deletions

View file

@ -5,6 +5,7 @@ using UnityEngine;
public class SlowlyDisappear : MonoBehaviour
{
public float disappearAfter;
public Gradient colorCurve;
protected float timeLeft;
protected SpriteRenderer sprite;
@ -21,9 +22,9 @@ public class SlowlyDisappear : MonoBehaviour
private void Update() {
timeLeft -= Time.deltaTime;
if(sprite != null) {
sprite.color = new Color(sprite.color.r, sprite.color.g, sprite.color.b, FractionLeft);
sprite.color = colorCurve.Evaluate(FractionLeft);
}
if(timeLeft < 0) {

View file

@ -149,6 +149,35 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
disappearAfter: 5
colorCurve:
serializedVersion: 2
key0: {r: 1, g: 0, b: 0, a: 0}
key1: {r: 1, g: 1, b: 1, a: 1}
key2: {r: 1, g: 0.82856506, b: 0.82856506, a: 0}
key3: {r: 0, g: 0, b: 0, a: 0}
key4: {r: 0, g: 0, b: 0, a: 0}
key5: {r: 0, g: 0, b: 0, a: 0}
key6: {r: 0, g: 0, b: 0, a: 0}
key7: {r: 0, g: 0, b: 0, a: 0}
ctime0: 0
ctime1: 65535
ctime2: 21203
ctime3: 0
ctime4: 0
ctime5: 0
ctime6: 0
ctime7: 0
atime0: 0
atime1: 65535
atime2: 0
atime3: 0
atime4: 0
atime5: 0
atime6: 0
atime7: 0
m_Mode: 0
m_NumColorKeys: 2
m_NumAlphaKeys: 2
--- !u!1 &8635663089806839545
GameObject:
m_ObjectHideFlags: 0