chenxin
2020-12-02 e6a2684b79e1b66844e37f99a18d17468455ee9e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
using DG.Tweening;
using KTGMGemClient;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
 
public class WaveLineSelEffect : MonoBehaviour
{
    public int waveLineId;
 
    protected Material mCurMat;
    protected float setSelTime = 0.0f;
    protected bool bInSel = false;
    /// <summary>
    /// 设置当前的WaveLine为选中状态
    /// </summary>
    /// <param name="sel"></param>
    public void SetWaveLineSel(bool sel)
    {
        if (sel)
        {
            //Debug.Log("技能启动特效");
            setSelTime = 0.2f;
            if (!bInSel)
                mCurMat.DOColor(new Color(1.0f, 1.0f, 1.0f, 1.0f), 0.4f);
            bInSel = true;
        }
    }
 
    public ParticleSystem myPS;//可以升级的特效
 
    public void SetParticleSystem(bool isOn)
    {
        if (isOn)
        {
            if (myPS.gameObject.activeSelf != isOn) myPS.gameObject.SetActive(isOn);
            myPS.Play();
        }
        else
        {
            myPS.Stop();
            if (myPS.gameObject.activeSelf != isOn) myPS.gameObject.SetActive(isOn);
        }
    }
 
    // Start is called before the first frame update
    void Start()
    {
        mCurMat = this.GetComponent<MeshRenderer>().material;
        myPS = transform.GetChild(0).GetChild(0).GetComponent<ParticleSystem>();
        EventCenter.Ins.Add<bool>((int)KTGMGemClient.EventType.EndlessStartDragSkill, EndlessStartDragSkill);
 
    }
 
    private void EndlessStartDragSkill(bool isOn)
    {
        if(!isOn){
            SetParticleSystem(isOn);
        }
    }
 
    // Update is called once per frame
    void Update()
    {
        if (setSelTime <= 0) return;
        setSelTime -= Time.deltaTime;
        if (setSelTime <= 0)
        {
            bInSel = false;
            setSelTime = 0.0f;
            mCurMat.DOColor(new Color(1.0f, 1.0f, 1.0f, 0.0f), 0.2f);
        }
    }
}