老师我给bird加了7个trail 然后复制了7给材质球 想给小鸟加个彩虹屁 所以把TestMyTrail里的weapontrail改成了List 但结果导致资源包里的weapon trial脚本不能修改trail的大小了
Mytrail代码段
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TestMyTrail : MonoBehaviour
{
private static TestMyTrail _Instance2;
void Awake()
{
_Instance2 = this;
}
//public WeaponTrail myTrail;
public List<WeaponTrail> Trail;
private float t=0.033f;
private float tempT = 0;
private float animationIncrement = 0.003f;
void LateUpdate()
{
t = Mathf.Clamp(Time.deltaTime,0,0.66f);
if (t > 0)
{
while (tempT < t)
{
tempT += animationIncrement;
for (int i = 0; i < Trail.Count; i++)
{
if (Trail[i].time > 0)
{
Trail[i].Itterate(Time.time - t + tempT);
}
else
{
Trail[i].ClearTrail();
}
}
}
tempT -= t;
for (int i = 0; i < Trail.Count; i++)
{
if (Trail[i].time > 0)
{
Trail[i].UpdateTrail(Time.time, t);
}
}
}
}
void Start()
{
// 默认没有拖尾效果
for (int i = 0; i < Trail.Count; i++)
{
Trail[i].SetTime(0.0f, 0.0f, 1.0f);
}
}
public void StartTrails()
{
for (int i = 0; i < Trail.Count; i++)
{
//设置拖尾时长
Trail[i].SetTime(2.0f, 0.0f, 1.0f);
//开始进行拖尾
Trail[i].StartTrail(0.5f, 0.4f);
}
}
public void CleanTrails()
{
//清除拖尾
for(int i=0;i<Trail.Count;i++)
Trail[i].ClearTrail();
}
}
彩虹屁 太大了 如果强行重合就变成白色了=。= 差了半天网上也没有