U3D_TobaccoWarehouseISMDTSy.../Assets/OutlineEffect/Samples/Demo/OutlineAnimation.cs

43 lines
934 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using cakeslice;
namespace cakeslice
{
public class OutlineAnimation : MonoBehaviour
{
bool pingPong = false;
// Use this for initialization
void Start()
{
}
// Update is called once per frame
void Update()
{
Color c = GetComponent<OutlineEffect>().lineColor0;
if(pingPong)
{
c.a += Time.deltaTime;
if(c.a >= 1)
pingPong = false;
}
else
{
c.a -= Time.deltaTime;
if(c.a <= 0)
pingPong = true;
}
c.a = Mathf.Clamp01(c.a);
GetComponent<OutlineEffect>().lineColor0 = c;
GetComponent<OutlineEffect>().UpdateMaterialsPublicProperties();
}
}
}