Пример #1
0
 public override void OnBeHitted(HitDef hitDef)
 {
     SetBeHitDefData(hitDef);
     if (hitDef.hitType == (int)HitDef.HitType.Attack)
     {
         AddHP(-hitDef.hitDamage);
         if (!IsAlive() && hitDef.knockAwayType == -1)
         {
             hitDef.knockAwayType = 0;
         }
         SendEvent(new Event()
         {
             type = EventType.PlayEffect, data = EffectDef.ConstructNormal(hitDef.spark, hitDef.sparkPos, this.GetFacing())
         });
         SendEvent(new Event()
         {
             type = EventType.PlaySound, data = new SoundDef()
             {
                 name = hitDef.hitSound, delay = 0, volume = 1
             }
         });
         if (this.GetMoveType() == MoveType.BeingHitted)
         {
             AddBeHitCount();
             hitDef.owner.SetHitCount(this.beHitCount);
         }
         else
         {
             ClearBeHitCount();
             AddBeHitCount();
         }
         if (hitDef.knockAwayType == -1)
         {
             if (this.GetPhysicsType() == PhysicsType.S)
             {
                 this.fsmMgr.ChangeState(5000, true);
             }
             else if (this.GetPhysicsType() == PhysicsType.C)
             {
                 this.fsmMgr.ChangeState(5010, true);
             }
             else if (this.GetPhysicsType() == PhysicsType.A)
             {
                 this.fsmMgr.ChangeState(5020, true);
             }
         }
         else
         {
             this.fsmMgr.ChangeState(5030, true);
         }
     }
     else if (hitDef.hitType == (int)HitDef.HitType.Throw)
     {
         this.fsmMgr.ChangeState(hitDef.p2StateNo, true);
     }
 }
Пример #2
0
 public override void OnGuardHit(HitDef hitDef)
 {
     SetBeHitDefData(hitDef);
     this.fsmMgr.ChangeState(this.GetPhysicsType() == PhysicsType.S ? 150 : 156);
     AddHP(-hitDef.guardDamage);
     SendEvent(new Event()
     {
         type = EventType.PlayEffect, data = EffectDef.ConstructNormal(hitDef.guardSpark, hitDef.sparkPos, this.GetFacing())
     });
     SendEvent(new Event()
     {
         type = EventType.PlaySound, data = new SoundDef()
         {
             name = hitDef.guardSound, delay = 0, volume = 1
         }
     });
 }