102 lines
2.2 KiB
C#
102 lines
2.2 KiB
C#
![]() |
// ***********************************************************************
|
|||
|
// Assembly : Game
|
|||
|
// Author : Kimch
|
|||
|
// Created : 2020-09-02
|
|||
|
// Description :
|
|||
|
// Last Modified By :
|
|||
|
// Last Modified On :
|
|||
|
// ***********************************************************************
|
|||
|
// <copyright file= "Ef_blur" company="Kimch"></copyright>
|
|||
|
// <summary></summary>
|
|||
|
// ***********************************************************************
|
|||
|
using UnityEngine;
|
|||
|
namespace G
|
|||
|
{
|
|||
|
public class Ef_energy_gather : MonoBehaviour
|
|||
|
{
|
|||
|
public Texture[] eftex = new Texture[2];
|
|||
|
|
|||
|
private int fogalpha = 2;
|
|||
|
|
|||
|
private float dt;
|
|||
|
|
|||
|
private float finish_delay = 1.2f;
|
|||
|
|
|||
|
private float show_delay = 0.1f;
|
|||
|
|
|||
|
private float plustimescale;
|
|||
|
|
|||
|
private Material mymaterial;
|
|||
|
|
|||
|
private Transform mytransform;
|
|||
|
|
|||
|
private bool anistart;
|
|||
|
|
|||
|
private Vector3 growVector;
|
|||
|
|
|||
|
private Vector3 smoothgrowVector;
|
|||
|
|
|||
|
private Vector2 offset;
|
|||
|
|
|||
|
private Color currentColor;
|
|||
|
|
|||
|
private Color targetColor;
|
|||
|
|
|||
|
private Color transColor;
|
|||
|
|
|||
|
private Color whiteclear = new Color(0.5f, 0.5f, 0.5f, 0f);
|
|||
|
|
|||
|
private void Awake()
|
|||
|
{
|
|||
|
mytransform = base.transform;
|
|||
|
mymaterial = base.GetComponent<Renderer>().sharedMaterial;
|
|||
|
}
|
|||
|
|
|||
|
private void Start()
|
|||
|
{
|
|||
|
targetColor = Color.gray;
|
|||
|
base.gameObject.SetActive(false);
|
|||
|
offset = Vector2.zero;
|
|||
|
mymaterial.color = whiteclear;
|
|||
|
}
|
|||
|
|
|||
|
public void SetTex(int _index, float _finishdelay)
|
|||
|
{
|
|||
|
mymaterial.mainTexture = eftex[_index];
|
|||
|
finish_delay = _finishdelay;
|
|||
|
}
|
|||
|
|
|||
|
private void Update()
|
|||
|
{
|
|||
|
if (dt > finish_delay)
|
|||
|
{
|
|||
|
mytransform.position = Vector3.one * 4f;
|
|||
|
base.gameObject.SetActive(false);
|
|||
|
dt = 0f;
|
|||
|
mymaterial.color = whiteclear;
|
|||
|
offset = Vector2.zero;
|
|||
|
targetColor = Color.gray;
|
|||
|
anistart = false;
|
|||
|
}
|
|||
|
else if (dt > finish_delay - 0.4f)
|
|||
|
{
|
|||
|
targetColor = Color.clear;
|
|||
|
}
|
|||
|
else if (dt > show_delay)
|
|||
|
{
|
|||
|
anistart = true;
|
|||
|
}
|
|||
|
dt += Time.deltaTime;
|
|||
|
if (anistart)
|
|||
|
{
|
|||
|
plustimescale = fogalpha / Time.timeScale;
|
|||
|
currentColor = mymaterial.color;
|
|||
|
transColor = Color.Lerp(currentColor, targetColor, Time.deltaTime * plustimescale);
|
|||
|
mymaterial.color = transColor;
|
|||
|
offset -= Vector2.up * Time.deltaTime * plustimescale * 0.5f;
|
|||
|
mymaterial.mainTextureOffset = offset;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|