| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313 | 
							- using Core.Triiger;
 
- using Core.Utility;
 
- using Fort23.Core;
 
- using Fort23.UTool;
 
- using GameLogic.Combat.Hero;
 
- using GameLogic.Combat.Hero.State;
 
- using UnityEngine;
 
- using Utility.CTween;
 
- namespace GameLogic.Combat.CombatTool
 
- {
 
-     public class MagicWeaponCollisionInfo : CObject, ITriggerEntity
 
-     {
 
-         public CombatMagicWeaponEntity a;
 
-         public CombatMagicWeaponEntity b;
 
-         public BesselPath _besselPathA;
 
-         public BesselPath _besselPathB;
 
-         public int id;
 
-         protected float _currTime;
 
-         /// <summary>
 
-         /// 状态 0=等待状态 1=飞行状态 2=碰撞状态
 
-         /// </summary>
 
-         public int State;
 
-         private IUnRegister _unRegister;
 
-         protected bool _isOne;
 
-         private bool _isPengZhuang;
 
-         protected ParticleSystemPool ParticleSystemPool;
 
-         private int triigerCount;
 
-         public void Init(CombatMagicWeaponEntity a, CombatMagicWeaponEntity b, int id)
 
-         {
 
-             this.id = id;
 
-             if (a.IsEnemy)
 
-             {
 
-                 (a, b) = (b, a);
 
-             }
 
-             this.a = a;
 
-             this.b = b;
 
-             a.MagicWeaponCollisionId = id;
 
-             b.MagicWeaponCollisionId = id;
 
-             State = 0;
 
-         }
 
-         private void OnTriggerEnter(Collider collider, ITriggerEntity triggerEntity)
 
-         {
 
-             // HeroEntityMono heroEntityMono = collider.GetComponent<HeroEntityMono>();
 
-             // if (heroEntityMono == null || (heroEntityMono.combatHeroEntity != b))
 
-             // {
 
-             //     return;
 
-             // }
 
-             //
 
-             // if (State != 1)
 
-             // {
 
-             //     return;
 
-             // }
 
-             //
 
-             // if (triigerCount >= 2)
 
-             // {
 
-             //     MagicWeaponPingDouState.MagicWeaponPingDouData rollingStateData =
 
-             //         CObjectPool.Instance.Fetch<MagicWeaponPingDouState.MagicWeaponPingDouData>();
 
-             //     rollingStateData.target = b;
 
-             //
 
-             //     a.CombatAIBasic.ChangeState(CombatHeroStateType.MagicWeaponPingDou,
 
-             //         rollingStateData);
 
-             //     MagicWeaponPingDouState.MagicWeaponPingDouData rollingStateData2 =
 
-             //         CObjectPool.Instance.Fetch<MagicWeaponPingDouState.MagicWeaponPingDouData>();
 
-             //     rollingStateData.target = a;
 
-             //     b.CombatAIBasic.ChangeState(CombatHeroStateType.MagicWeaponPingDou,
 
-             //         rollingStateData2);
 
-             //     State = 2;
 
-             //     _currTime = 0;
 
-             //     CombatController.currActiveCombat.GameTimeLineParticleFactory.CreateParticle("fx_fb_duipin_dian",
 
-             //         a.dotPos, null, false, null, delegate(ParticleSystemPool particleSystemPool)
 
-             //         {
 
-             //             particleSystemPool.transform.rotation =
 
-             //                 a.GameObject.transform.rotation;
 
-             //             ParticleSystemPool = particleSystemPool;
 
-             //         });
 
-             // }
 
-             // else
 
-             // {
 
-             //     CombatController.currActiveCombat.GameTimeLineParticleFactory.CreateParticle("fx_fb_duipin_hit",
 
-             //         collider.transform.position, null, false, null, delegate(ParticleSystemPool particleSystemPool)
 
-             //         {
 
-             //             particleSystemPool.transform.rotation =
 
-             //                 a.GameObject.transform.rotation;
 
-             //         });
 
-             //     triigerCount++;
 
-             //     // a.ReduceHp(40);
 
-             //     // _trigger = true;
 
-             //     // _triggerTime = 0.5f;
 
-             // }
 
-         }
 
-         protected void PongZhuang()
 
-         {
 
-             if (State != 1||_isPengZhuang)
 
-             {
 
-                 return;
 
-             }
 
-             _isPengZhuang = true;
 
-             if (triigerCount >= 1)
 
-             {
 
-                 MagicWeaponPingDouState.MagicWeaponPingDouData rollingStateData =
 
-                     CObjectPool.Instance.Fetch<MagicWeaponPingDouState.MagicWeaponPingDouData>();
 
-                 rollingStateData.target = b;
 
-                 a.CombatAIBasic.ChangeState(CombatHeroStateType.MagicWeaponPingDou,
 
-                     rollingStateData);
 
-                 MagicWeaponPingDouState.MagicWeaponPingDouData rollingStateData2 =
 
-                     CObjectPool.Instance.Fetch<MagicWeaponPingDouState.MagicWeaponPingDouData>();
 
-                 rollingStateData.target = a;
 
-                 b.CombatAIBasic.ChangeState(CombatHeroStateType.MagicWeaponPingDou,
 
-                     rollingStateData2);
 
-                 State = 2;
 
-                 _currTime = 0;
 
-                 CombatController.currActiveCombat.GameTimeLineParticleFactory.CreateParticle("fx_fb_duipin_dian",
 
-                     a.dotPos, null, false, null, delegate(ParticleSystemPool particleSystemPool)
 
-                     {
 
-                         particleSystemPool.transform.rotation =
 
-                             a.GameObject.transform.rotation;
 
-                         ParticleSystemPool = particleSystemPool;
 
-                     });
 
-             }
 
-             else
 
-             {
 
-                 CombatController.currActiveCombat.GameTimeLineParticleFactory.CreateParticle("fx_fb_duipin_hit",
 
-                     a.dotPos, null, false, null, delegate(ParticleSystemPool particleSystemPool)
 
-                     {
 
-                         particleSystemPool.transform.rotation =
 
-                             a.GameObject.transform.rotation;
 
-                     });
 
-                 triigerCount++;
 
-                 // a.ReduceHp(40);
 
-                 // _trigger = true;
 
-                 // _triggerTime = 0.5f;
 
-             }
 
-         }
 
-         protected void SetBesselA()
 
-         {
 
-             _besselPathA = new BesselPath();
 
-             _besselPathA.controlPoints.Add(a.dotPos);
 
-             _besselPathA.controlPoints.Add(a.GameObject.transform.TransformPoint(new Vector3(-9.87f, 4, 2)));
 
-             _besselPathA.controlPoints.Add(b.GameObject.transform.TransformPoint(new Vector3(-12.66f, 1, 5)));
 
-             _besselPathA.controlPoints.Add(b.dotPos);
 
-             GameObject G1 = new GameObject("BesselPathMono33");
 
-             BesselPathMono besselPathMono1 = G1.AddComponent<BesselPathMono>();
 
-             besselPathMono1.isRun = true;
 
-             besselPathMono1.BesselPath = _besselPathA;
 
-             _besselPathB = new BesselPath();
 
-             _besselPathB.controlPoints.Add(b.dotPos);
 
-             _besselPathB.controlPoints.Add(
 
-                 b.GameObject.transform.TransformPoint(new Vector3(11.89f, -0.29f, -3.28f)));
 
-             _besselPathB.controlPoints.Add(
 
-                 a.GameObject.transform.TransformPoint(new Vector3(12.67f, -3.03f, -3.5f)));
 
-             _besselPathB.controlPoints.Add(a.dotPos);
 
-             GameObject G2 = new GameObject("BesselPathMono44");
 
-             BesselPathMono besselPathMono2 = G2.AddComponent<BesselPathMono>();
 
-             besselPathMono2.isRun = true;
 
-             besselPathMono2.BesselPath = _besselPathB;
 
-         }
 
-         protected void SetBesselB()
 
-         {
 
-             _besselPathA = new BesselPath();
 
-             _besselPathA.controlPoints.Add(a.dotPos);
 
-             _besselPathA.controlPoints.Add(a.GameObject.transform.TransformPoint(new Vector3(-3.41f, 4, -7.23f)));
 
-             _besselPathA.controlPoints.Add(b.GameObject.transform.TransformPoint(new Vector3(-2.64f, 1, 5)));
 
-             _besselPathA.controlPoints.Add(b.dotPos);
 
-             GameObject G = new GameObject("BesselPathMono11");
 
-             BesselPathMono besselPathMono = G.AddComponent<BesselPathMono>();
 
-             besselPathMono.isRun = true;
 
-             besselPathMono.BesselPath = _besselPathA;
 
-             _besselPathB = new BesselPath();
 
-             _besselPathB.controlPoints.Add(b.dotPos);
 
-             _besselPathB.controlPoints.Add(
 
-                 b.GameObject.transform.TransformPoint(new Vector3(8.5f, -3.93f, -9.58f)));
 
-             _besselPathB.controlPoints.Add(
 
-                 a.GameObject.transform.TransformPoint(new Vector3(1.45f, -3.03f, 4.6f)));
 
-             _besselPathB.controlPoints.Add(a.dotPos);
 
-             GameObject G2 = new GameObject("BesselPathMono22");
 
-             BesselPathMono besselPathMono2 = G2.AddComponent<BesselPathMono>();
 
-             besselPathMono2.isRun = true;
 
-             besselPathMono2.BesselPath = _besselPathB;
 
-         }
 
-         public void Update(float t)
 
-         {
 
-             if (State == 0)
 
-             {
 
-                 if (a.CombatAIBasic.stateControl.CurrStateName.Equals(CombatHeroStateType.idle) &&
 
-                     b.CombatAIBasic.stateControl.CurrStateName.Equals(CombatHeroStateType.idle))
 
-                 {
 
-                     State = 1;
 
-                     int odds = Random.Range(0, 100);
 
-                     if (odds < 50)
 
-                     {
 
-                         SetBesselA();
 
-                     }
 
-                     else
 
-                     {
 
-                         SetBesselB();
 
-                     }
 
-                     _unRegister = a.GameObject.OnTriggerEnterEvent(this, OnTriggerEnter);
 
-                     _isOne = false;
 
-                     _currTime = 0;
 
-                 }
 
-             }
 
-             if (State == 1)
 
-             {
 
-                 _currTime += t * CustomTweenManager.AnimationCurveLibrary.fabaoSpeed;
 
-                 float v = CustomTweenManager.AnimationCurveLibrary.fabaoDuiPing.Evaluate(_currTime);
 
-                 BesselPath besselPath = _isOne ? _besselPathB : _besselPathA;
 
-                 Vector3 a1 = besselPath.CalculatePoint(v);
 
-                 Vector3 a2 = besselPath.CalculatePoint(v - 0.01f);
 
-                 Vector3 b1 = besselPath.CalculatePoint(1 - v);
 
-                 Vector3 b2 = besselPath.CalculatePoint(1 - v + 0.01f);
 
-                 a.combatHeroGameObject.SetPosition(a1);
 
-                 a.GameObject.transform.rotation = Quaternion.LookRotation((a1 - a2).normalized);
 
-                 b.combatHeroGameObject.SetPosition(b1);
 
-                 b.GameObject.transform.rotation = Quaternion.LookRotation((b1 - b2).normalized);
 
-                 if (_currTime > 0.48f)
 
-                 {
 
-                     PongZhuang();
 
-                 }
 
-                 if (_currTime >= 1)
 
-                 {
 
-                     _currTime = 0;
 
-                     _isOne = !_isOne;
 
-                     _isPengZhuang = false;
 
-                 }
 
-             }
 
-             else if (State == 2)
 
-             {
 
-                 _currTime += t;
 
-                 if (_currTime >2)
 
-                 {
 
-                     State = 3;
 
-                     _currTime = 0;
 
-                     CombatCalculateTool.Instance.FaBaoPengZhuang(a,b);
 
-                     CombatMagicWeaponEntity combatMagicWeaponEntityA = a;
 
-                     CombatMagicWeaponEntity combatMagicWeaponEntityB = b;
 
-                     if (combatMagicWeaponEntityA.HpBl<=0)
 
-                     {
 
-                         combatMagicWeaponEntityA.MagicWeaponDie();
 
-                     }
 
-                     if (combatMagicWeaponEntityB.HpBl<=0)
 
-                     {
 
-                         combatMagicWeaponEntityB.MagicWeaponDie();
 
-                     }
 
-                 }
 
-             }
 
-         }
 
-         public void SetState(int state)
 
-         {
 
-             State = state;
 
-         }
 
-         public override void ActiveObj()
 
-         {
 
-         }
 
-         public override void DormancyObj()
 
-         {
 
-             a = null;
 
-             b = null;
 
-         }
 
-         public void Finish()
 
-         {
 
-             LogTool.Log("碰撞完成");
 
-             if (a.HpBl > 0)
 
-             {
 
-                 a.CombatAIBasic.ChangeState(CombatHeroStateType.att);
 
-                 a.MagicWeaponCollisionId = -1;
 
-                 b.MagicWeaponCollisionId = -1;
 
-             }
 
-             if (b.HpBl > 0)
 
-             {
 
-                 b.CombatAIBasic.ChangeState(CombatHeroStateType.att);
 
-                 a.MagicWeaponCollisionId = -1;
 
-                 b.MagicWeaponCollisionId = -1;
 
-             }
 
-             GObjectPool.Instance.Recycle(ParticleSystemPool);
 
-             ParticleSystemPool = null;
 
-             triigerCount = 0;
 
-             _isPengZhuang = false;
 
-         }
 
-         public string tag { get; }
 
-     }
 
- }
 
 
  |