赞
踩
using System.Collections; using System.Collections.Generic; using UnityEngine; public class RedLightFlash : MonoBehaviour { private HighlightPlus.HighlightEffect highEffect; public float Duration = 1; Color colora; float value = 0; bool isUp = false; bool isDown = false; // Start is called before the first frame update void Start() { highEffect = this.GetComponent<HighlightPlus.HighlightEffect>(); if (highEffect != null) { colora = highEffect.outlineColor; value = colora.a; } } // Update is called once per frame void Update() { if (highEffect == null) return; float speed = 1 / Duration; if (value >= 1) { isUp = false; isDown = true; } if (value <= 0) { isUp = true; isDown = false; } if (isUp) value += Time.deltaTime * speed; if (isDown) value -= Time.deltaTime * speed; highEffect.outlineColor = new Color(colora.r, colora.g, colora.b, value); } }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。