blob: e765ab63596ffa225df58de511fbb240e235c0b3 (
plain)
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
|
using System;
using System.Collections.Generic;
using KKSG;
using XUtliPoolLib;
namespace XMainClient
{
internal class XMobaTowerTargetMgr
{
private List<TowerInfo> m_TowerList = new List<TowerInfo>();
public void Clear()
{
for (int i = 0; i < this.m_TowerList.Count; i++)
{
this.m_TowerList[i].Destroy();
}
this.m_TowerList.Clear();
}
public void TryAddTower(XEntity newEntity)
{
bool flag = !XEntity.ValideEntity(newEntity);
if (!flag)
{
bool flag2 = newEntity.IsRole || newEntity.Attributes == null;
if (!flag2)
{
bool flag3 = !XSingleton<XEntityMgr>.singleton.IsOpponent(newEntity.Attributes.FightGroup);
if (!flag3)
{
XOthersAttributes xothersAttributes = newEntity.Attributes as XOthersAttributes;
bool flag4 = xothersAttributes == null;
if (!flag4)
{
bool flag5 = newEntity.Attributes == null || (newEntity.Attributes.Tag & EntityMask.Moba_Tower) == 0u;
if (!flag5)
{
for (int i = 0; i < this.m_TowerList.Count; i++)
{
bool flag6 = this.m_TowerList[i].UID == newEntity.ID;
if (flag6)
{
return;
}
}
TowerInfo towerInfo = new TowerInfo();
towerInfo.UID = newEntity.ID;
towerInfo.Entity = newEntity;
towerInfo.WarningSqrRadius = xothersAttributes.EnterFightRange + XSingleton<XGlobalConfig>.singleton.MobaTowerFxOffset;
towerInfo.WarningSqrRadius *= towerInfo.WarningSqrRadius;
this.m_TowerList.Add(towerInfo);
XSingleton<XDebug>.singleton.AddGreenLog("Tower ", newEntity.ID.ToString(), " add, Type ID = ", newEntity.Attributes.TypeID.ToString(), null, null);
}
}
}
}
}
}
public void OnTargetChange(EntityTargetData data)
{
bool flag = data == null;
if (!flag)
{
for (int i = 0; i < this.m_TowerList.Count; i++)
{
TowerInfo towerInfo = this.m_TowerList[i];
bool flag2 = towerInfo.UID == data.entityUID;
if (flag2)
{
towerInfo.TargetUID = data.targetUID;
towerInfo.Update();
break;
}
}
}
}
public void Update()
{
for (int i = 0; i < this.m_TowerList.Count; i++)
{
TowerInfo towerInfo = this.m_TowerList[i];
bool flag = !XEntity.ValideEntity(towerInfo.Entity);
if (flag)
{
towerInfo.Destroy();
XSingleton<XDebug>.singleton.AddGreenLog("Tower remove ", towerInfo.Entity.ID.ToString(), null, null, null, null);
this.m_TowerList.RemoveAt(i);
i--;
}
else
{
towerInfo.Update();
}
}
}
}
}
|