| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 | using System;using System.Collections;using System.Collections.Generic;using UnityEngine;public class WaterRangeCtrlTool : MonoBehaviour{    public static WaterRangeCtrlTool _Instance;    public GameObject[] FxObjects;    public Material waterRangeMat;    public AnimationCurve waterCurveSZ;    public AnimationCurve waterCurveVZ;    public AnimationCurve waterCurve_65000;    public AnimationCurve waterCurve_70000;    public int waterCurveIndex    {        private set;        get;    }    private void Awake()    {        _Instance = this;        FxObjects = new GameObject[this.transform.childCount];        for (int i = 0; i < FxObjects.Length; i++)        {            FxObjects[i] = this.gameObject.transform.GetChild(i).gameObject;            FxObjects[i].SetActive(true);        }        waterRangeMat = this.transform.Find("NeiHe_FenQu").GetComponent<MeshRenderer>().material;        ChangeWaterCurve(0);    }    public void ShowFx(bool reSetValue)    {        if (reSetValue)        {            SetRangeValue(0);        }        for (int i = 0; i < FxObjects.Length; i++)        {            FxObjects[i].SetActive(true);        }    }    public void HideFx()    {        for (int i = 0; i < FxObjects.Length; i++)        {            FxObjects[i].SetActive(false);        }    }        public void SetRangeValue(float value)    {        float rangeValue=0;        switch (waterCurveIndex)        {            case 0 :                rangeValue  = waterCurve_65000.Evaluate(value);                break;            case 1 :                rangeValue  = waterCurve_70000.Evaluate(value);                break;        }        waterRangeMat.SetFloat("_ClipLength",rangeValue);    }    public void ChangeWaterCurve(int index)    {        waterCurveIndex = index;    }}
 |