summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/XBullet.cs
blob: 48fad5167f8d96624a16efba46c0aa9e539d10ac (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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
using System;
using System.Collections.Generic;
using UnityEngine;
using XUpdater;
using XUtliPoolLib;

namespace XMainClient
{
	internal class XBullet
	{
		public XBulletCore BulletCore
		{
			get
			{
				return this._data;
			}
		}

		public ulong ID
		{
			get
			{
				return this._id;
			}
		}

		public ulong ExtraID
		{
			get
			{
				return this._extra_id;
			}
			set
			{
				this._extra_id = value;
			}
		}

		private ulong _id = 0UL;

		private ulong _extra_id = 0UL;

		private bool _active = true;

		private bool _effectual = true;

		private bool _pingpong = false;

		private bool _hit_triggered = false;

		private int _tail_results = 0;

		private uint _tail_results_token = 0u;

		private float _elapsed = 0f;

		private XFx _bullet = null;

		private XBulletCore _data;

		private Vector3 _origin = Vector3.zero;

		private SmallBuffer<XBullet.XBulletTarget> _hurt_target;

		private IXFmod _iFmod;

		public struct XBulletTarget
		{
			public ulong TargetID;

			public uint TimerToken;

			public bool Hurtable;

			public int HurtCount;
		}

		public XBullet(ulong id, XBulletCore data)
		{
			this.Init(id, data);
		}

		public void Deny()
		{
			this._effectual = false;
		}

		private void LoadFinish(UnityEngine.Object obj, object cbOjb)
		{
			bool flag = this._iFmod != null;
			if (flag)
			{
				this._iFmod.Destroy();
				XSingleton<XUpdater.XUpdater>.singleton.XPlatform.ReturnClass(EClassType.ERuntimeFMOD, this._iFmod);
				this._iFmod = null;
			}
			bool flag2 = !string.IsNullOrEmpty(this._data.Result.LongAttackData.Audio);
			if (flag2)
			{
				this._iFmod = (XSingleton<XUpdater.XUpdater>.singleton.XPlatform.CreateClass(EClassType.ERuntimeFMOD) as IXFmod);
				Rigidbody rigidbody = null;
				GameObject gameObject = obj as GameObject;
				bool flag3 = gameObject != null;
				if (flag3)
				{
					rigidbody = gameObject.GetComponent<Rigidbody>();
				}
				bool flag4 = this._iFmod != null;
				if (flag4)
				{
					this._iFmod.Init(gameObject, rigidbody);
					XSingleton<XAudioMgr>.singleton.PlaySound(this._iFmod, AudioChannel.Motion, this._data.Result.LongAttackData.Audio);
				}
			}
		}

		private XFx FilterFx(string path)
		{
			bool flag = string.IsNullOrEmpty(path);
			XFx result;
			if (flag)
			{
				result = XSingleton<XFxMgr>.singleton.CreateFx("", new LoadCallBack(this.LoadFinish), true);
			}
			else
			{
				bool flag2 = XSingleton<XScene>.singleton.FilterFx && (this._data.Firer == null || (!this._data.Firer.IsPlayer && !this._data.Firer.IsBoss && !(this._data.Firer is XDummy))) && (this._data.Target == null || !this._data.Target.IsPlayer);
				if (flag2)
				{
					Vector3 position = XSingleton<XEntityMgr>.singleton.Player.EngineObject.Position;
					Vector3 origin = this._data.BulletRay.origin;
					float num = XFxMgr.FilterFxDis4;
					float num2 = (origin.x - position.x) * (origin.x - position.x) + (origin.z - position.z) * (origin.z - position.z);
					bool flag3 = this._data.Result != null && this._data.Result.LongAttackData != null;
					if (flag3)
					{
						num = this._data.Result.LongAttackData.Velocity * this._data.Result.LongAttackData.Runningtime;
					}
					bool flag4 = num2 < XFxMgr.FilterFxDis4 || num2 < num * num;
					if (flag4)
					{
						result = XSingleton<XFxMgr>.singleton.CreateFx(this._data.Prefab, new LoadCallBack(this.LoadFinish), true);
					}
					else
					{
						result = XSingleton<XFxMgr>.singleton.CreateFx("", new LoadCallBack(this.LoadFinish), true);
					}
				}
				else
				{
					result = XSingleton<XFxMgr>.singleton.CreateFx(path, null, true);
				}
			}
			return result;
		}

		public void Init(ulong id, XBulletCore data)
		{
			this._id = id;
			this._extra_id = 0UL;
			this._active = true;
			this._effectual = true;
			this._tail_results = 0;
			this._pingpong = false;
			this._hit_triggered = false;
			this._elapsed = 0f;
			this._data = data;
			this._origin = Vector3.zero;
			string path = XSingleton<XGlobalConfig>.singleton.PreFilterPrefab(this._data.Prefab);
			this._bullet = this.FilterFx(path);
			this._bullet.Play(this._data.BulletRay.origin, (this._data.Velocity > 0f) ? Quaternion.LookRotation(this._data.BulletRay.direction) : Quaternion.LookRotation(this._data.Firer.EngineObject.Forward), Vector3.one, 1f);
			this._hurt_target.debugName = "XBullet._hurt_target";
			XSingleton<XBulletMgr>.singleton.GetSmallBuffer(ref this._hurt_target, 4);
		}

		private void OnRefined(object o)
		{
			ulong num = (ulong)o;
			int i = 0;
			int count = this._hurt_target.Count;
			while (i < count)
			{
				XBullet.XBulletTarget xbulletTarget = this._hurt_target[i];
				bool flag = xbulletTarget.TargetID == num && xbulletTarget.HurtCount < this._data.Result.LongAttackData.Refine_Count;
				if (flag)
				{
					xbulletTarget.Hurtable = true;
					this._hurt_target[i] = xbulletTarget;
					break;
				}
				i++;
			}
		}

		private void OnRefined()
		{
			int i = 0;
			int count = this._hurt_target.Count;
			while (i < count)
			{
				XBullet.XBulletTarget xbulletTarget = this._hurt_target[i];
				xbulletTarget.Hurtable = true;
				xbulletTarget.HurtCount = 0;
				XSingleton<XTimerMgr>.singleton.KillTimer(xbulletTarget.TimerToken);
				this._hurt_target[i] = xbulletTarget;
				i++;
			}
		}

		private void OnPingPong()
		{
			this._pingpong = true;
			bool autoRefine_at_Half = this._data.Result.LongAttackData.AutoRefine_at_Half;
			if (autoRefine_at_Half)
			{
				this.OnRefined();
			}
		}

		public void Expire()
		{
			this._active = false;
			bool flag = this._tail_results != 0;
			if (flag)
			{
				XSingleton<XTimerMgr>.singleton.KillTimer(this._tail_results_token);
				this._tail_results = this._data.Result.LongAttackData.TriggerAtEnd_Count;
			}
		}

		public bool IsExpired()
		{
			bool flag = !this._effectual || (!this._data.Demonstration && !XEntity.ValideEntity(this._data.Firer));
			bool result;
			if (flag)
			{
				result = true;
			}
			else
			{
				bool flag2 = this._tail_results != 0;
				if (flag2)
				{
					bool flag3 = this._tail_results >= this._data.Result.LongAttackData.TriggerAtEnd_Count;
					result = flag3;
				}
				else
				{
					bool flag4 = this._data.Result.LongAttackData.IsPingPong && !this._pingpong;
					if (flag4)
					{
						bool flag5 = XSingleton<XCommon>.singleton.IsGreater(this._elapsed, this._data.Life);
						if (flag5)
						{
							this.OnPingPong();
						}
					}
					bool flag6 = !this._active || (!this._pingpong && XSingleton<XCommon>.singleton.IsGreater(this._elapsed, this._data.Life));
					bool flag7 = this._data.Result.LongAttackData.TriggerAtEnd_Count <= 0;
					if (flag7)
					{
						result = flag6;
					}
					else
					{
						bool flag8 = flag6;
						if (flag8)
						{
							this._active = false;
							this.OnTailResult(null);
							result = false;
						}
						else
						{
							result = flag6;
						}
					}
				}
			}
			return result;
		}

		private void OnTailResult(object o)
		{
			bool flag = o == null;
			if (flag)
			{
				this._tail_results = 0;
				this.FakeDestroyBulletObject();
			}
			bool flag2 = this._tail_results < this._data.Result.LongAttackData.TriggerAtEnd_Count;
			if (flag2)
			{
				this._tail_results++;
				this.TailResult(this._tail_results == 1);
				XSingleton<XTimerMgr>.singleton.KillTimer(this._tail_results_token);
				this._tail_results_token = XSingleton<XTimerMgr>.singleton.SetTimer(this._data.Result.LongAttackData.TriggerAtEnd_Cycle, new XTimerMgr.ElapsedEventHandler(this.OnTailResult), this);
			}
		}

		public bool IsHurtEntity(ulong id)
		{
			int i = 0;
			int count = this._hurt_target.Count;
			while (i < count)
			{
				XBullet.XBulletTarget xbulletTarget = this._hurt_target[i];
				bool flag = xbulletTarget.TargetID == id;
				if (flag)
				{
					return !xbulletTarget.Hurtable;
				}
				i++;
			}
			return false;
		}

		private void TailResult(bool present)
		{
			bool triggerAtEnd = this._data.Result.LongAttackData.TriggerAtEnd;
			if (triggerAtEnd)
			{
				bool warning = this._data.Warning;
				if (warning)
				{
					this._bullet.Position = this._data.WarningPos;
				}
				bool flag = !this._data.Demonstration && !XSingleton<XGame>.singleton.SyncMode;
				if (flag)
				{
					this.Result(null, this._data.Result.LongAttackData.TriggerAtEnd_Count == 0);
				}
			}
			bool flag2 = !present;
			if (!flag2)
			{
				bool flag3 = !string.IsNullOrEmpty(this._data.Result.LongAttackData.End_Fx);
				if (flag3)
				{
					Vector3 position = this._bullet.Position;
					float num = 0f;
					bool flag4 = this._data.Demonstration || XSingleton<XScene>.singleton.TryGetTerrainY(position, out num);
					if (flag4)
					{
						XFx xfx = XSingleton<XFxMgr>.singleton.CreateFx(this._data.Result.LongAttackData.End_Fx, null, true);
						xfx.DelayDestroy = this._data.Result.LongAttackData.EndFx_LifeTime;
						Quaternion rotation = this._bullet.Rotation;
						bool endFx_Ground = this._data.Result.LongAttackData.EndFx_Ground;
						if (endFx_Ground)
						{
							position.y = (this._data.Demonstration ? this._bullet.Position.y : num);
							rotation = (this._data.Demonstration ? Quaternion.identity : XSingleton<XCommon>.singleton.RotateToGround(position, this._bullet.Forward));
						}
						xfx.Play(position, rotation, Vector3.one, 1f);
						XSingleton<XBulletMgr>.singleton.LogEndFx(xfx);
						XSingleton<XFxMgr>.singleton.DestroyFx(xfx, false);
					}
				}
				bool flag5 = !string.IsNullOrEmpty(this._data.Result.LongAttackData.End_Audio);
				if (flag5)
				{
					XSingleton<XAudioMgr>.singleton.PlaySound(this._data.Firer, AudioChannel.Motion, this._data.Result.LongAttackData.End_Audio, this._bullet.Position);
				}
			}
		}

		private void FakeDestroyBulletObject()
		{
			bool flag = this._bullet != null;
			if (flag)
			{
				Vector3 position = this._bullet.Position;
				Quaternion rotation = this._bullet.Rotation;
				bool flag2 = this._iFmod != null;
				if (flag2)
				{
					XSingleton<XAudioMgr>.singleton.StopSound(this._iFmod);
					this._iFmod.Destroy();
					XSingleton<XUpdater.XUpdater>.singleton.XPlatform.ReturnClass(EClassType.ERuntimeFMOD, this._iFmod);
					this._iFmod = null;
				}
				XSingleton<XFxMgr>.singleton.DestroyFx(this._bullet, true);
				this._bullet = null;
				this._bullet = XSingleton<XFxMgr>.singleton.CreateFx("", null, true);
				this._bullet.Position = position;
				this._bullet.Rotation = rotation;
				this._bullet.SetActive(true);
			}
		}

		public void Destroy(bool leave = false)
		{
			XSingleton<XTimerMgr>.singleton.KillTimer(this._tail_results_token);
			bool flag = !leave && this._data.Result.LongAttackData.TriggerAtEnd_Count == 0 && (this._data.Demonstration || XEntity.ValideEntity(this._data.Firer));
			if (flag)
			{
				this.TailResult(true);
			}
			bool flag2 = this._bullet != null;
			if (flag2)
			{
				bool flag3 = this._iFmod != null;
				if (flag3)
				{
					XSingleton<XAudioMgr>.singleton.StopSound(this._iFmod);
					this._iFmod.Destroy();
					XSingleton<XUpdater.XUpdater>.singleton.XPlatform.ReturnClass(EClassType.ERuntimeFMOD, this._iFmod);
					this._iFmod = null;
				}
				XSingleton<XFxMgr>.singleton.DestroyFx(this._bullet, true);
				this._bullet = null;
			}
			bool flag4 = this._data.Result.LongAttackData.Refine_Cycle > 0f;
			if (flag4)
			{
				int i = 0;
				int count = this._hurt_target.Count;
				while (i < count)
				{
					XBullet.XBulletTarget xbulletTarget = this._hurt_target[i];
					XSingleton<XTimerMgr>.singleton.KillTimer(xbulletTarget.TimerToken);
					i++;
				}
			}
			XSingleton<XBulletMgr>.singleton.ReturnSmallBuffer(ref this._hurt_target);
		}

		public void OnResult(XEntity target)
		{
			bool flag = XEntity.ValideEntity(target);
			if (flag)
			{
				XBullet.XBulletTarget xbulletTarget;
				xbulletTarget.HurtCount = 0;
				xbulletTarget.TimerToken = 0u;
				xbulletTarget.TargetID = 0UL;
				int num = -1;
				int i = 0;
				int count = this._hurt_target.Count;
				while (i < count)
				{
					xbulletTarget = this._hurt_target[i];
					bool flag2 = xbulletTarget.TargetID == target.ID;
					if (flag2)
					{
						num = i;
						break;
					}
					i++;
				}
				bool flag3 = num < 0;
				if (flag3)
				{
					xbulletTarget = default(XBullet.XBulletTarget);
					xbulletTarget.TargetID = target.ID;
					num = this._hurt_target.Count;
					this._hurt_target.Add(xbulletTarget);
				}
				XSingleton<XTimerMgr>.singleton.KillTimer(xbulletTarget.TimerToken);
				xbulletTarget.Hurtable = false;
				xbulletTarget.HurtCount++;
				xbulletTarget.TimerToken = ((this._data.Result.LongAttackData.Refine_Cycle > 0f) ? XSingleton<XTimerMgr>.singleton.SetTimer(this._data.Result.LongAttackData.Refine_Cycle, new XTimerMgr.ElapsedEventHandler(this.OnRefined), target.ID) : 0u);
				this._hurt_target[num] = xbulletTarget;
				bool flag4 = this._data.TriggerMove && XEntity.ValideEntity(this._data.Firer);
				if (flag4)
				{
					Vector3 vector = (this._data.Firer.EngineObject.Position - target.EngineObject.Position).normalized * target.RealEntity.Radius;
					this._data.Firer.CorrectMe(target.EngineObject.Position + vector, this._data.Firer.EngineObject.Forward, false, false);
				}
			}
			bool triggerOnce = this._data.Result.LongAttackData.TriggerOnce;
			if (triggerOnce)
			{
				this.OnOnceTriggered();
			}
		}

		private void OnOnceTriggered()
		{
			bool triggerOnce = this._data.Result.LongAttackData.TriggerOnce;
			if (triggerOnce)
			{
				bool isPingPong = this._data.Result.LongAttackData.IsPingPong;
				if (isPingPong)
				{
					this.OnPingPong();
				}
				else
				{
					this._active = false;
				}
			}
		}

		private void Result(XEntity target, bool cycle = true)
		{
			bool demonstration = this._data.Demonstration;
			if (!demonstration)
			{
				bool flag = target == null;
				if (flag)
				{
					XSkill.SkillResult(this, this._bullet.Forward, this._bullet.Position, cycle);
				}
				else
				{
					bool flag2 = !this._data.Result.Attack_Only_Target || target == this._data.Target;
					if (flag2)
					{
						bool syncMode = XSingleton<XGame>.singleton.SyncMode;
						if (syncMode)
						{
							bool triggerOnce = this._data.Result.LongAttackData.TriggerOnce;
							if (triggerOnce)
							{
								this.OnOnceTriggered();
							}
						}
						else
						{
							Vector3 hitdir = target.EngineObject.Position - this._origin;
							hitdir.y = 0f;
							hitdir.Normalize();
							XSkill.SkillResult(this._data.Token, this._data.Firer, this._data.SkillCore, this, this._data.Sequnce, this._data.ResultID, this._data.ResultTime, hitdir, target);
						}
						bool triggerOnce2 = this._data.Result.LongAttackData.TriggerOnce;
						if (triggerOnce2)
						{
							this._hit_triggered = true;
						}
					}
				}
			}
		}

		public void Update(float fDeltaT)
		{
			bool flag = !this._active;
			if (!flag)
			{
				this._elapsed += fDeltaT;
				float num = 0f;
				Vector3 vector = Vector3.forward;
				switch (this._data.Result.LongAttackData.Type)
				{
				case XResultBulletType.Sphere:
				case XResultBulletType.Plane:
					num = ((this._elapsed > this._data.Running && this._elapsed < this._data.Life) ? 0f : this._data.Velocity) * fDeltaT;
					vector = this._bullet.Forward;
					break;
				case XResultBulletType.Satellite:
				{
					bool flag2 = this._elapsed - fDeltaT <= XCommon.XEps;
					if (flag2)
					{
						Vector3 position = this._data.Firer.EngineObject.Position + this._data.BulletRay.direction * this._data.Result.LongAttackData.RingRadius;
						position.y = this._bullet.Position.y;
						this._bullet.Position = position;
						num = 0f;
						vector = XSingleton<XCommon>.singleton.HorizontalRotateVetor3(this._data.Firer.MoveObj.Forward, (float)((this._data.Result.LongAttackData.Palstance < 0f) ? -90 : 90), true);
					}
					else
					{
						Vector3 vector2 = XSingleton<XCommon>.singleton.HorizontalRotateVetor3(this._data.BulletRay.direction, this._data.Result.LongAttackData.Palstance * (this._elapsed - fDeltaT), true) * this._data.Result.LongAttackData.RingRadius;
						Vector3 vector3 = XSingleton<XCommon>.singleton.HorizontalRotateVetor3(this._data.BulletRay.direction, this._data.Result.LongAttackData.Palstance * this._elapsed, true) * this._data.Result.LongAttackData.RingRadius;
						this._bullet.Forward = XSingleton<XCommon>.singleton.Horizontal(vector3 - vector2);
						vector3 += this._data.Firer.EngineObject.Position;
						Vector3 vector4 = vector3 - this._bullet.Position;
						vector4.y = 0f;
						num = vector4.magnitude;
						vector = vector4.normalized;
					}
					break;
				}
				case XResultBulletType.Ring:
				{
					Vector3 position2 = this._data.Firer.EngineObject.Position;
					position2.y = this._bullet.Position.y;
					this._bullet.Position = position2;
					break;
				}
				}
				bool flag3 = this._data.Result.LongAttackData.IsPingPong && this._pingpong;
				if (flag3)
				{
					bool flag4 = !this._data.Demonstration && !XEntity.ValideEntity(this._data.Firer);
					if (flag4)
					{
						this._active = false;
						return;
					}
					Vector3 vector5 = this._data.Firer.EngineObject.Position - this._bullet.Position;
					vector5.y = 0f;
					bool flag5 = num * num >= vector5.sqrMagnitude;
					if (flag5)
					{
						this._active = false;
						return;
					}
					vector = vector5.normalized;
				}
				else
				{
					bool flag6 = this._data.Result.LongAttackData.Follow && XEntity.ValideEntity(this._data.Target);
					if (flag6)
					{
						vector = XSingleton<XCommon>.singleton.Horizontal(this._data.Target.EngineObject.Position - this._bullet.Position);
					}
				}
				bool flag7 = this._data.Result.LongAttackData.Type != XResultBulletType.Satellite;
				if (flag7)
				{
					this._bullet.Forward = vector;
				}
				Vector3 vector6 = vector * num;
				this._origin = this._bullet.Position;
				this._bullet.Position += vector6;
				bool demonstration = this._data.Demonstration;
				if (!demonstration)
				{
					float num2 = 0f;
					bool flag8 = !XSingleton<XScene>.singleton.TryGetTerrainY(this._bullet.Position, out num2);
					if (flag8)
					{
						bool isPingPong = this._data.Result.LongAttackData.IsPingPong;
						if (isPingPong)
						{
							this.OnPingPong();
						}
						else
						{
							this._active = false;
						}
					}
					else
					{
						bool staticCollider = this._data.Result.LongAttackData.StaticCollider;
						if (staticCollider)
						{
							bool flag9 = num2 < 0f;
							if (flag9)
							{
								bool isPingPong2 = this._data.Result.LongAttackData.IsPingPong;
								if (isPingPong2)
								{
									this.OnPingPong();
								}
								else
								{
									this._active = false;
								}
								return;
							}
						}
						bool dynamicCollider = this._data.Result.LongAttackData.DynamicCollider;
						if (dynamicCollider)
						{
							bool flag10 = !XSingleton<XScene>.singleton.CheckDynamicBlock(this._origin, this._bullet.Position);
							if (flag10)
							{
								bool isPingPong3 = this._data.Result.LongAttackData.IsPingPong;
								if (isPingPong3)
								{
									this.OnPingPong();
								}
								else
								{
									this._active = false;
								}
								return;
							}
						}
						bool flag11 = !this._data.HasTarget;
						if (flag11)
						{
							bool flyWithTerrain = this._data.FlyWithTerrain;
							if (flyWithTerrain)
							{
								Vector3 position3 = this._bullet.Position;
								position3.y = num2 + this._data.InitHeight;
								this._bullet.Position = position3;
							}
							else
							{
								bool flag12 = Mathf.Abs(this._bullet.Position.y - num2) < 0.2f || num2 < 0f;
								if (flag12)
								{
									this._active = false;
									bool flag13 = !string.IsNullOrEmpty(this._data.Result.LongAttackData.HitGround_Fx);
									if (flag13)
									{
										XFx xfx = XSingleton<XFxMgr>.singleton.CreateFx(this._data.Result.LongAttackData.HitGround_Fx, null, true);
										xfx.DelayDestroy = this._data.Result.LongAttackData.HitGroundFx_LifeTime;
										Quaternion rotation = this._bullet.Rotation;
										rotation = XSingleton<XCommon>.singleton.RotateToGround(this._bullet.Position, this._bullet.Forward);
										xfx.Play(this._bullet.Position, rotation, Vector3.one, 1f);
										XSingleton<XFxMgr>.singleton.DestroyFx(xfx, false);
									}
									return;
								}
							}
							vector6 = this._bullet.Position - this._origin;
						}
						bool syncMode = XSingleton<XGame>.singleton.SyncMode;
						if (!syncMode)
						{
							bool manipulation = this._data.Result.LongAttackData.Manipulation;
							if (manipulation)
							{
								List<XEntity> opponent = XSingleton<XEntityMgr>.singleton.GetOpponent(this._data.Firer);
								Vector3 position4 = this._bullet.Position;
								for (int i = 0; i < opponent.Count; i++)
								{
									XEntity xentity = opponent[i];
									bool flag14 = !XEntity.ValideEntity(xentity);
									if (!flag14)
									{
										Vector3 vector7 = position4 - xentity.EngineObject.Position;
										vector7.y = 0f;
										bool flag15 = vector7.magnitude < this._data.Result.LongAttackData.ManipulationRadius;
										if (flag15)
										{
											float num3 = this._data.Result.LongAttackData.ManipulationForce * fDeltaT;
											xentity.ApplyMove(vector7.normalized * Mathf.Min(vector7.magnitude, num3));
										}
									}
								}
							}
							bool hit_triggered = this._hit_triggered;
							if (!hit_triggered)
							{
								bool withCollision = this._data.Result.LongAttackData.WithCollision;
								if (withCollision)
								{
									switch (this._data.Result.LongAttackData.Type)
									{
									case XResultBulletType.Sphere:
									case XResultBulletType.Satellite:
									{
										Vector3 vector8;
										vector8= new Vector3(vector6.x, 0f, vector6.z);
										float num4 = vector8.magnitude * 0.5f;
										vector.y = 0f;
										float num5 = (vector.sqrMagnitude == 0f) ? 0f : Vector3.Angle(Vector3.right, vector);
										bool flag16 = num5 > 0f && XSingleton<XCommon>.singleton.Clockwise(Vector3.right, vector);
										if (flag16)
										{
											num5 = -num5;
										}
										XBullet.BulletCollideUnit(this._data.Firer, new Vector3(this._origin.x + vector.x * num4, 0f, this._origin.z + vector.z * num4), num4, num5, this._data.Radius, this);
										break;
									}
									case XResultBulletType.Plane:
										XBullet.PlaneBulletCollideUnit(this._data.Firer, this._origin, vector6, this._data.Radius, this);
										break;
									case XResultBulletType.Ring:
									{
										float num6 = XSingleton<XCommon>.singleton.IsGreater(this._elapsed, this._data.Life) ? 0f : (this._data.Result.LongAttackData.RingFull ? (XSingleton<XCommon>.singleton.IsGreater(this._elapsed, this._data.Life * 0.5f) ? (this._data.Life - this._elapsed) : this._elapsed) : this._elapsed);
										float num7 = num6 * this._data.Result.LongAttackData.RingVelocity;
										float or = num7 + this._data.Result.LongAttackData.RingRadius;
										XBullet.RingBulletCollideUnit(this._data.Firer, num7, or, this);
										break;
									}
									}
								}
							}
						}
					}
				}
			}
		}

		private static void RingBulletCollideUnit(XEntity firer, float ir, float or, XBullet bullet)
		{
			Vector3 position = firer.EngineObject.Position;
			List<XEntity> opponent = XSingleton<XEntityMgr>.singleton.GetOpponent(firer);
			for (int i = 0; i < opponent.Count; i++)
			{
				bool flag = !XEntity.ValideEntity(opponent[i]);
				if (!flag)
				{
					bool flag2 = false;
					bool flag3 = opponent[i].Present != null && opponent[i].Present.PresentLib.Huge;
					if (flag3)
					{
						SeqListRef<float> hugeMonsterColliders = opponent[i].Present.PresentLib.HugeMonsterColliders;
						for (int j = 0; j < hugeMonsterColliders.Count; j++)
						{
							float num = hugeMonsterColliders[j, 2] * opponent[i].Scale;
							Vector3 vector = opponent[i].HugeMonsterColliderCenter(j) - position;
							vector.y = 0f;
							float sqrMagnitude = vector.sqrMagnitude;
							flag2 = (sqrMagnitude > ir * ir && sqrMagnitude < or * or);
							bool flag4 = flag2;
							if (flag4)
							{
								break;
							}
						}
					}
					else
					{
						Vector3 vector2 = opponent[i].RadiusCenter - position;
						vector2.y = 0f;
						float sqrMagnitude2 = vector2.sqrMagnitude;
						flag2 = (sqrMagnitude2 > ir * ir && sqrMagnitude2 < or * or);
					}
					bool flag5 = flag2;
					if (flag5)
					{
						bullet.Result(opponent[i], true);
					}
					bool flag6 = bullet.IsExpired();
					if (flag6)
					{
						break;
					}
				}
			}
		}

		private static void PlaneBulletCollideUnit(XEntity firer, Vector3 origin, Vector3 move, float r, XBullet bullet)
		{
			Vector3 vector = XSingleton<XCommon>.singleton.HorizontalRotateVetor3(move, 90f, true);
			Vector3 q = origin + vector * r;
			Vector3 q2 = origin - vector * r;
			List<XEntity> opponent = XSingleton<XEntityMgr>.singleton.GetOpponent(firer);
			for (int i = 0; i < opponent.Count; i++)
			{
				bool flag = !XEntity.ValideEntity(opponent[i]);
				if (!flag)
				{
					bool flag2 = false;
					bool flag3 = opponent[i].Present != null && opponent[i].Present.PresentLib.Huge;
					if (flag3)
					{
						SeqListRef<float> hugeMonsterColliders = opponent[i].Present.PresentLib.HugeMonsterColliders;
						for (int j = 0; j < hugeMonsterColliders.Count; j++)
						{
							float num = hugeMonsterColliders[j, 2] * opponent[i].Scale;
							Vector3 vector2 = opponent[i].HugeMonsterColliderCenter(j);
							flag2 = XSingleton<XCommon>.singleton.IsLineSegmentCross(vector2, vector2 - move, q, q2);
							bool flag4 = flag2;
							if (flag4)
							{
								break;
							}
						}
					}
					else
					{
						Vector3 radiusCenter = opponent[i].RadiusCenter;
						flag2 = XSingleton<XCommon>.singleton.IsLineSegmentCross(radiusCenter, radiusCenter - move, q, q2);
					}
					bool flag5 = flag2;
					if (flag5)
					{
						bullet.Result(opponent[i], true);
					}
					bool flag6 = bullet.IsExpired();
					if (flag6)
					{
						break;
					}
				}
			}
		}

		private static void BulletCollideUnit(XEntity firer, Vector3 rectcenter, float hlen, float rotation, float r, XBullet bullet)
		{
			List<XEntity> opponent = XSingleton<XEntityMgr>.singleton.GetOpponent(firer);
			for (int i = 0; i < opponent.Count; i++)
			{
				bool flag = !XEntity.ValideEntity(opponent[i]);
				if (!flag)
				{
					bool flag2 = false;
					bool flag3 = opponent[i].Present != null && opponent[i].Present.PresentLib.Huge;
					if (flag3)
					{
						SeqListRef<float> hugeMonsterColliders = opponent[i].Present.PresentLib.HugeMonsterColliders;
						for (int j = 0; j < hugeMonsterColliders.Count; j++)
						{
							float num = hugeMonsterColliders[j, 2] * opponent[i].Scale;
							Vector3 vector = opponent[i].HugeMonsterColliderCenter(j);
							vector -= rectcenter;
							vector.y = 0f;
							flag2 = XSingleton<XCommon>.singleton.IsRectCycleCross(hlen, r, vector, num);
							bool flag4 = !flag2;
							if (flag4)
							{
								float num2 = num;
								float magnitude = vector.magnitude;
								flag2 = (magnitude - num2 < r);
							}
							bool flag5 = flag2;
							if (flag5)
							{
								break;
							}
						}
					}
					else
					{
						Vector3 vector2 = opponent[i].RadiusCenter;
						vector2 -= rectcenter;
						vector2.y = 0f;
						vector2 = XSingleton<XCommon>.singleton.HorizontalRotateVetor3(vector2, rotation, false);
						flag2 = XSingleton<XCommon>.singleton.IsRectCycleCross(hlen, r, vector2, opponent[i].Radius);
						bool flag6 = !flag2;
						if (flag6)
						{
							float radius = opponent[i].Radius;
							float magnitude2 = vector2.magnitude;
							flag2 = (magnitude2 - radius < r);
						}
					}
					bool flag7 = flag2;
					if (flag7)
					{
						bullet.Result(opponent[i], true);
					}
					bool flag8 = bullet.IsExpired();
					if (flag8)
					{
						break;
					}
				}
			}
		}
	}
}