少年修仙传客户端代码仓库
client_Wu Xijin
2019-02-13 c7f64d977c4e2884d5411a5a2d0f37b6afa52963
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
 
using UnityEngine;
 
public class Prepare_200 : SMB_Base
{
    private Skill m_CacheSkill;
 
    private int m_LimitTime;
    private float m_Duration;
    private int m_CastTime;
 
    protected override void OnEnter(GActor owner, Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        base.OnEnter(owner, animator, stateInfo, layerIndex);
 
        GActorFight _fight = owner as GActorFight;
 
        if (_fight == null
         || _fight.SkillMgr.CurCastSkill == null)
        {
            return;
        }
 
        m_CacheSkill = _fight.SkillMgr.Get(_fight.SkillMgr.CurCastSkill.id);
        m_CastTime = m_CacheSkill.skillInfo.config.CastTime;
 
        if (m_CastTime > 0)
        {
            m_CacheSkill.OnPreparingEnd += OnSkillPrepareEnd;
            m_CacheSkill.OnPreparingFail += OnSkillPrepareFail;
        }
 
        SkillHelper.EffectValue _effectValue;
        if (m_CacheSkill.skillInfo.effectValue.TryGetValue(1206, out _effectValue))
        {
            m_LimitTime = _effectValue.value1;
            m_Duration = m_LimitTime * m_CastTime;
        }
 
        if (_fight.ServerInstID == PlayerDatas.Instance.PlayerId)
        {
            (_fight as GA_Hero).StopRush();
        }
 
        if (_fight is GA_Player)
        {
            (_fight as GA_Player).StopMoveToPosition();
        }
    }
 
    protected override void OnUpdate(GActor owner, Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        base.OnUpdate(owner, animator, stateInfo, layerIndex);
 
        if (m_CacheSkill == null)
        {
            return;
        }
    }
 
    protected override void OnExit(GActor owner, Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        base.OnExit(owner, animator, stateInfo, layerIndex);
 
        if (m_CastTime > 0)
        {
            m_CacheSkill.OnPreparingEnd -= OnSkillPrepareEnd;
            m_CacheSkill.OnPreparingFail -= OnSkillPrepareFail;
        }
    }
 
    private void OnSkillPrepareEnd(uint serverObjId)
    {
        GActorFight _fight = GAMgr.Instance.GetBySID(serverObjId) as GActorFight;
 
        if (_fight == null)
        {
            return;
        }
 
        _fight.Idle();
 
        if (m_CacheSkill != null)
        {
            if (m_CacheSkill.skillInfo.config.Skillactmark > 10
             && m_CacheSkill.skillInfo.config.Skillactmark < 100)
            {
                _fight.NextAction = m_CacheSkill.skillInfo.config.Skillactmark;
                return;
            }
 
            m_CacheSkill.SkillPreparing = false;
        }
    }
 
    private void OnSkillPrepareFail(uint serverObjId)
    {
        GActorFight _fight = GAMgr.Instance.GetBySID(serverObjId) as GActorFight;
 
        if (_fight == null)
        {
            return;
        }
 
        _fight.SkillMgr.DoingPrepareSkill = false;
        _fight.Idle();
 
        if (m_CacheSkill != null)
        {
            m_CacheSkill.SkillPreparing = false;
        }
    }
}