unity捕鱼达人

水纹波动的实现:

public class EF_WaterWave : MonoBehaviour
{
    public Texture[] textures;
    private Material material;
    private int index=0;
    void Start()
    {
        material = GetComponent<MeshRenderer>().material;

//重复执行某函数,0表示立即执行,0.1f表示时间 间隔    

InvokeRepeating("ChangeTexture",0,0.1f);
    }


    void ChangeTexture()
    {
        material.mainTexture = textures[index];
        index = (index + 1) % textures.Length;
    }
}

猜你喜欢

转载自blog.csdn.net/qq_32354205/article/details/83044559
今日推荐