实现效果如上图所示。代码如下:
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
// 残影效果
public class AfterImageComponent : ActorComponent
{
class AfterImage
{
public Mesh mesh;
public Material material;
public Matrix4x4 matrix;
public float showStartTime;
public float duration; // 残影镜像存在时间
public float alpha;
public bool needRemove = false;
}
private float _duration; // 残影特效持续时间
private float _interval; // 间隔
private float _fadeTime; // 淡出时间
private List<AfterImage> _imageList = new List<AfterImage>();
private Shader _shaderAfterImage;
void Awa