diff options
author | chai <chaifix@163.com> | 2021-01-25 14:28:30 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-01-25 14:28:30 +0800 |
commit | 6eb915c129fc90c6f4c82ae097dd6ffad5239efc (patch) | |
tree | 7dd2be50edf41f36b60fac84696e731c13afe617 /Client/Assets/Scripts/XMainClient/XLevelSpawnTask.cs |
+scripts
Diffstat (limited to 'Client/Assets/Scripts/XMainClient/XLevelSpawnTask.cs')
-rw-r--r-- | Client/Assets/Scripts/XMainClient/XLevelSpawnTask.cs | 163 |
1 files changed, 163 insertions, 0 deletions
diff --git a/Client/Assets/Scripts/XMainClient/XLevelSpawnTask.cs b/Client/Assets/Scripts/XMainClient/XLevelSpawnTask.cs new file mode 100644 index 00000000..56f4eed3 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/XLevelSpawnTask.cs @@ -0,0 +1,163 @@ +using System;
+using KKSG;
+using UnityEngine;
+using XUtliPoolLib;
+
+namespace XMainClient
+{
+ internal class XLevelSpawnTask : XLevelBaseTask
+ {
+ public uint _EnemyID;
+
+ public int _MonsterRotate;
+
+ public int _MonsterIndex;
+
+ public Vector3 _MonsterPos;
+
+ public LevelSpawnType _SpawnType;
+
+ public bool _IsSummonTask;
+
+ public XLevelSpawnTask(XLevelSpawnInfo ls) : base(ls)
+ {
+ this._IsSummonTask = false;
+ }
+
+ public XEntity CreateClientMonster(uint id, float yRotate, Vector3 pos, int _waveid)
+ {
+ Quaternion rotation = Quaternion.Euler(0f, yRotate, 0f);
+ XEntity xentity = XSingleton<XEntityMgr>.singleton.CreateEntity(id, pos, rotation, true, uint.MaxValue);
+ bool flag = xentity != null;
+ XEntity result;
+ if (flag)
+ {
+ xentity.Wave = _waveid;
+ xentity.CreateTime = Time.realtimeSinceStartup;
+ XAIEventArgs @event = XEventPool<XAIEventArgs>.GetEvent();
+ @event.DepracatedPass = true;
+ @event.Firer = XSingleton<XEntityMgr>.singleton.Player;
+ @event.EventType = 1;
+ @event.EventArg = "SpawnMonster";
+ XSingleton<XEventMgr>.singleton.FireEvent(@event, 0.05f);
+ result = xentity;
+ }
+ else
+ {
+ result = null;
+ }
+ return result;
+ }
+
+ public XEntity CreateServerAttrMonster(UnitAppearance data, float yRotate, Vector3 pos, int _waveid)
+ {
+ XAttributes xattributes = XSingleton<XAttributeMgr>.singleton.InitAttrFromServer(data.uID, data.nickid, data.unitType, data.unitName, data.attributes, data.fightgroup, data.isServerControl, data.skills, data.bindskills, new XOutLookAttr((OutLook)null), data.level, 0u);
+ xattributes.Outlook.SetData(data.outlook, xattributes.TypeID);
+ bool flag = xattributes.Type == EntitySpecies.Species_Role;
+ XEntity xentity;
+ if (flag)
+ {
+ xentity = XSingleton<XEntityMgr>.singleton.Add(XSingleton<XEntityMgr>.singleton.CreateRole(xattributes, pos, Quaternion.Euler(0f, yRotate, 0f), false, false));
+ }
+ else
+ {
+ xentity = XSingleton<XEntityMgr>.singleton.Add(XSingleton<XEntityMgr>.singleton.CreateEntity(xattributes, pos, Quaternion.Euler(0f, yRotate, 0f), false));
+ }
+ bool flag2 = xentity != null;
+ XEntity result;
+ if (flag2)
+ {
+ xentity.Wave = _waveid;
+ bool flag3 = XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_BOSSRUSH;
+ if (flag3)
+ {
+ XLevelDocument specificDocument = XDocuments.GetSpecificDocument<XLevelDocument>(XLevelDocument.uuID);
+ BossRushTable.RowData bossRushConfig = specificDocument.GetBossRushConfig(XSingleton<XScene>.singleton.SceneID, (uint)(XSingleton<XLevelStatistics>.singleton.ls._total_kill + 1));
+ bool flag4 = data != null;
+ if (flag4)
+ {
+ float num = 1f;
+ double attr = xentity.Attributes.GetAttr(XAttributeDefine.XAttr_MaxHP_Basic);
+ double value = attr * (double)num;
+ xentity.Attributes.SetAttr(XAttributeDefine.XAttr_MaxHP_Basic, value);
+ xentity.Attributes.SetAttr(XAttributeDefine.XAttr_CurrentHP_Basic, value);
+ }
+ }
+ bool isDead = data.IsDead;
+ if (isDead)
+ {
+ XSingleton<XDeath>.singleton.DeathDetect(xentity, null, true);
+ result = null;
+ }
+ else
+ {
+ result = xentity;
+ }
+ }
+ else
+ {
+ result = null;
+ }
+ return result;
+ }
+
+ public override bool Execute(float time)
+ {
+ base.Execute(time);
+ XLevelDynamicInfo xlevelDynamicInfo = null;
+ bool flag = !this._IsSummonTask;
+ if (flag)
+ {
+ xlevelDynamicInfo = this._spawner.GetWaveDynamicInfo(this._id);
+ bool flag2 = xlevelDynamicInfo == null;
+ if (flag2)
+ {
+ return true;
+ }
+ }
+ XEntity xentity = null;
+ bool flag3 = this._SpawnType == LevelSpawnType.Spawn_Source_Monster;
+ if (flag3)
+ {
+ xentity = this.CreateClientMonster(this._EnemyID, (float)this._MonsterRotate, this._MonsterPos + new Vector3(0f, 0.02f, 0f), this._id);
+ XSingleton<XLevelStatistics>.singleton.ls.AddLevelSpawnEntityCount(xentity.ID);
+ }
+ else
+ {
+ bool flag4 = this._SpawnType == LevelSpawnType.Spawn_Source_Doodad;
+ if (!flag4)
+ {
+ UnitAppearance cacheServerMonster = XSingleton<XLevelSpawnMgr>.singleton.GetCacheServerMonster((uint)this._id);
+ bool flag5 = cacheServerMonster != null;
+ if (flag5)
+ {
+ xentity = this.CreateServerAttrMonster(cacheServerMonster, (float)this._MonsterRotate, this._MonsterPos + new Vector3(0f, 0.02f, 0f), this._id);
+ }
+ XSingleton<XLevelStatistics>.singleton.ls.AddLevelSpawnEntityCount(xentity.ID);
+ }
+ }
+ bool flag6 = xlevelDynamicInfo != null;
+ if (flag6)
+ {
+ bool flag7 = xentity != null;
+ if (flag7)
+ {
+ xlevelDynamicInfo._generateCount++;
+ xlevelDynamicInfo._enemyIds.Add(xentity.ID);
+ }
+ bool flag8 = xlevelDynamicInfo._generateCount == xlevelDynamicInfo._TotalCount;
+ if (flag8)
+ {
+ xlevelDynamicInfo._generatetime = time;
+ }
+ bool flag9 = xentity != null && xentity.IsBoss;
+ if (flag9)
+ {
+ XSingleton<XTutorialHelper>.singleton.HasBoss = true;
+ return false;
+ }
+ }
+ return true;
+ }
+ }
+}
|