少年修仙传客户端代码仓库
hch
2025-06-12 204ef05a831c9484e2abc561d27ecbff7c797453
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
using UnityEngine;
 
public class CmdB402 : CmdBase
{
    private uint m_PlayerID;
    private Vector3 m_TargetPostion = Vector3.zero;
    private float m_LimitTime;
 
    public override void Init(GameNetPackBasic netPack)
    {
        HB402_tagMCRush m_NetPack = netPack as HB402_tagMCRush;
        m_PlayerID = m_NetPack.ID;
        m_TargetPostion.x = (m_NetPack.PosX - GA_Hero.MapOffset.x) * .5f;
        m_TargetPostion.z = (m_NetPack.PosY - GA_Hero.MapOffset.z) * .5f;
 
        m_LimitTime = Time.realtimeSinceStartup;
    }
 
    public override void Update()
    {
        if (m_TargetPostion == Vector3.zero)
        {
            m_Finished = true;
            return;
        }
 
        GActorPlayerBase _player = GAMgr.Instance.GetBySID(m_PlayerID) as GActorPlayerBase;
 
        if (_player == null || _player.ActorInfo.serverDie)
        {
            m_Finished = true;
            return;
        }
 
        _player.StartRush();
 
        float _chkDistance = MathUtility.DistanceSqrtXZ(_player.Pos, m_TargetPostion);
 
        _player.MoveToPosition(m_TargetPostion);
 
        if (_chkDistance < 0.5f)
        {
            _player.StopRush();
            m_Finished = true;
        }
 
        if (Time.realtimeSinceStartup - m_LimitTime > 2f)
        {
            _player.StopRush();
            m_Finished = true;
        }
 
    }
 
}