少年修仙传客户端代码仓库
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
using UnityEngine;
 
public class Cmd0501 : CmdBase
{
    private uint ObjID;
    private byte MoveType;
    private Vector3 m_TargetPosition;
 
    public override void Init(GameNetPackBasic netPack)
    {
        H0501_tagObjMove m_NetPack = netPack as H0501_tagObjMove;
        ObjID = m_NetPack.ObjID;
        MoveType = m_NetPack.MoveType;
        m_TargetPosition.x = (m_NetPack.DestPosX - GA_Hero.MapOffset.x) * .5f;
        m_TargetPosition.z = (m_NetPack.DestPosY - GA_Hero.MapOffset.z) * .5f;
 
        GActorFight _actor = GAMgr.Instance.GetBySID(ObjID) as GActorFight;
        if (_actor != null && _actor.ActorInfo.serverDie == false)
        {
            _actor.ActorInfo.moveSpeed = 500f / m_NetPack.Speed;
        }
    }
 
    public override void Update()
    {
        if (m_TargetPosition == Vector3.zero)
        {
            m_Finished = true;
            return;
        }
 
        GActorFight _actor = GAMgr.Instance.GetBySID(ObjID) as GActorFight;
 
        if (_actor == null
         || _actor.ActorInfo.serverDie)
        {
            m_Finished = true;
            return;
        }
 
        if (_actor.SkillMgr.CurCastSkill != null)
        {
            if (_actor.SkillMgr.CurCastSkill.SkillCompelete == false)
            {
                return;
            }
        }
 
        m_TargetPosition.y = _actor.Pos.y;
 
        float _chkDistance = MathUtility.DistanceSqrtXZ(_actor.Pos, m_TargetPosition);
 
        if (_chkDistance < 0.5f)
        {
            if (_actor.ActorType == GameObjType.gotPlayer)
            {
                (_actor as GActorPlayerBase).StopRush();
            }
            m_Finished = true;
        }
        else
        {
            if (_actor.State != E_ActorState.AutoRun)
            {
                _actor.MoveToPosition(m_TargetPosition);
            }
        }
    }
}