summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/AI/AIRuntimeCallMonster.cs
blob: 2346e82128c959fcdfc055eed365a937bf5fa281 (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
using System;
using System.Xml;
using UnityEngine;
using XUtliPoolLib;

namespace XMainClient
{
	internal class AIRuntimeCallMonster : AIRunTimeNodeAction
	{
		private float _dist;

		private string _dist_name;

		private float _angle;

		private string _angle_name;

		private string _monster_id_name;

		private int _monster_id;

		private int _copy_monster_id;

		private int _max_monster_num;

		private float _life_time;

		private float _delay_time;

		private Vector3 _pos;

		private string _pos_name;

		private int _born_type;

		private Vector3 _pos1;

		private Vector3 _pos2;

		private Vector3 _pos3;

		private Vector3 _pos4;

		private bool _force_place;

		private float _delta_arg;

		public AIRuntimeCallMonster(XmlElement node) : base(node)
		{
			this._dist = float.Parse(node.GetAttribute("Shared_DistmValue"));
			this._dist_name = node.GetAttribute("Shared_DistName");
			this._angle = float.Parse(node.GetAttribute("Shared_AnglemValue"));
			this._angle_name = node.GetAttribute("Shared_AngleName");
			this._monster_id_name = node.GetAttribute("MonsterId2Name");
			this._monster_id = int.Parse(node.GetAttribute("MonsterId"));
			this._copy_monster_id = int.Parse(node.GetAttribute("CopyMonsterId"));
			this._max_monster_num = int.Parse(node.GetAttribute("MaxMonsterNum"));
			this._life_time = float.Parse(node.GetAttribute("LifeTime"));
			this._delay_time = float.Parse(node.GetAttribute("DelayTime"));
			string[] array = node.GetAttribute("Shared_PosmValue").Split(new char[]
			{
				':'
			});
			this._pos = new Vector3(float.Parse(array[0]), float.Parse(array[1]), float.Parse(array[2]));
			this._pos_name = node.GetAttribute("Shared_PosName");
			this._born_type = int.Parse(node.GetAttribute("BornType"));
			array = node.GetAttribute("Pos1").Split(new char[]
			{
				':'
			});
			this._pos1 = new Vector3(float.Parse(array[0]), float.Parse(array[1]), float.Parse(array[2]));
			array = node.GetAttribute("Pos2").Split(new char[]
			{
				':'
			});
			this._pos2 = new Vector3(float.Parse(array[0]), float.Parse(array[1]), float.Parse(array[2]));
			array = node.GetAttribute("Pos3").Split(new char[]
			{
				':'
			});
			this._pos3 = new Vector3(float.Parse(array[0]), float.Parse(array[1]), float.Parse(array[2]));
			array = node.GetAttribute("Pos4").Split(new char[]
			{
				':'
			});
			this._pos4 = new Vector3(float.Parse(array[0]), float.Parse(array[1]), float.Parse(array[2]));
			this._force_place = (int.Parse(node.GetAttribute("ForcePlace")) != 0);
			this._delta_arg = float.Parse(node.GetAttribute("DeltaArg"));
		}

		public override bool Update(XEntity entity)
		{
			CallMonsterData callMonsterData = new CallMonsterData();
			callMonsterData.mAIArgDist = entity.AI.AIData.GetFloatByName(this._dist_name, this._dist);
			callMonsterData.mAIArgAngle = entity.AI.AIData.GetFloatByName(this._angle_name, this._angle);
			callMonsterData.mAIArgMonsterId = entity.AI.AIData.GetIntByName(this._monster_id_name, this._monster_id);
			callMonsterData.mAIArgCopyMonsterId = this._copy_monster_id;
			callMonsterData.mAIArgLifeTime = this._life_time;
			callMonsterData.mAIArgDelayTime = this._delay_time;
			callMonsterData.mAIArgPos = entity.AI.AIData.GetVector3ByName(this._pos_name, this._pos);
			callMonsterData.mAIArgBornType = this._born_type;
			callMonsterData.mAIArgPos1 = this._pos1;
			callMonsterData.mAIArgPos2 = this._pos2;
			callMonsterData.mAIArgPos3 = this._pos3;
			callMonsterData.mAIArgPos4 = this._pos4;
			callMonsterData.mAIArgForcePlace = this._force_place;
			callMonsterData.mAIArgDeltaArg = this._delta_arg;
			return XSingleton<XAIOtherActions>.singleton.CallMonster(entity, callMonsterData);
		}
	}
}