summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/XSecurityAIInfo.cs
blob: 591a1fef0415f7fd7f7cb3405f655d9a70096879 (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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
using System;
using UnityEngine;

namespace XMainClient
{
	internal class XSecurityAIInfo
	{
		public int _PhysicalAttackNum;

		public int _SkillAttackNum;

		public float _LifeTime;

		public int _BossCallMonsterTotal;

		public int _BossCallMonsterCount;

		public void Reset()
		{
			this._PhysicalAttackNum = 0;
			this._SkillAttackNum = 0;
			this._LifeTime = 0f;
			this._BossCallMonsterTotal = 0;
			this._BossCallMonsterCount = 0;
		}

		public void Merge(XSecurityAIInfo other)
		{
			bool flag = other == null;
			if (!flag)
			{
				this._PhysicalAttackNum += other._PhysicalAttackNum;
				this._SkillAttackNum += other._SkillAttackNum;
				this._LifeTime += other._LifeTime;
				this._BossCallMonsterTotal += other._BossCallMonsterTotal;
				this._BossCallMonsterCount += other._BossCallMonsterCount;
			}
		}

		public void OnMobCast()
		{
			this._BossCallMonsterCount++;
		}

		public void OnMobMonster()
		{
			this._BossCallMonsterTotal++;
		}

		public void OnPhysicalAttack()
		{
			this._PhysicalAttackNum++;
		}

		public void OnSkillAttack()
		{
			this._SkillAttackNum++;
		}

		public void OnCallMonster(XEntity entity)
		{
			this._BossCallMonsterTotal++;
			bool flag = Time.time - entity.AI.LastCallMonsterTime > 1f;
			if (flag)
			{
				this._BossCallMonsterCount++;
				entity.AI.LastCallMonsterTime = Time.time;
			}
		}

		public void OnExternalCallMonster()
		{
			this._BossCallMonsterTotal++;
			this._BossCallMonsterCount++;
		}

		public void SetLifeTime(float life)
		{
			this._LifeTime = life;
		}

		public static XSecurityAIInfo TryGetStatistics(XEntity entity)
		{
			XSecurityStatistics xsecurityStatistics = XSecurityStatistics.TryGetStatistics(entity);
			bool flag = xsecurityStatistics == null;
			XSecurityAIInfo result;
			if (flag)
			{
				result = null;
			}
			else
			{
				result = xsecurityStatistics.AIInfo;
			}
			return result;
		}

		public static void SendBossData(XSecurityAIInfo info, string keywords)
		{
			XStaticSecurityStatistics.Append("BossAttackCount", (float)info._PhysicalAttackNum);
			XStaticSecurityStatistics.Append("BossUseSkillCount", (float)info._SkillAttackNum);
			XStaticSecurityStatistics.Append("BossTimeTotal", (float)((int)(info._LifeTime * 1000f)));
			XStaticSecurityStatistics.Append("BossCallCount", (float)info._BossCallMonsterCount);
			XStaticSecurityStatistics.Append("BossCallTotal", (float)info._BossCallMonsterTotal);
		}

		public static void SendEnemyData(XSecurityAIInfo info, string keywords)
		{
			XStaticSecurityStatistics.Append("MonsterAttackCount", (float)info._PhysicalAttackNum);
			XStaticSecurityStatistics.Append("MonsterSkillCount", (float)info._SkillAttackNum);
			XStaticSecurityStatistics.Append("MonsterTimeTotal", info._LifeTime);
		}
	}
}