Exemplo n.º 1
0
        public void IsBeDead()
        {
            ActionDead action = new ActionDead(Owner);

            action.IsPushStack = false;
            Owner.DispatchEvent(ControllerCommand.SetActiveAction, action);
        }
Exemplo n.º 2
0
 public override void DoUpdate()
 {
     if (pause)
     {
         return;
     }
     if (Owner.property.heroObjType == KHeroObjectType.hotPlayer && null != Owner.AnimCmp && null != Owner.Weapon)
     {
         if (Owner.ActiveAction != null && Owner.ActiveAction.WeaponPosition != WeaponComponent.BIND_POINT.DEFAULT)
         {
             Owner.Weapon.SetWeaponPosition(Owner.ActiveAction.WeaponPosition);
         }
         else if (Owner.AnimCmp.IsFighting())
         {
             Owner.Weapon.SetWeaponPosition(WeaponComponent.BIND_POINT.RIGHT_HAND);
         }
         else
         {
             Owner.Weapon.SetWeaponPosition(WeaponComponent.BIND_POINT.BEI);
         }
     }
     if (Owner.property.isDeadTemp)
     {
         if (null == Owner.ActiveAction || (Owner.ActiveAction.isDead == false && Owner.ActiveAction.actionType != Action.ACTION_TYPE.FLY))
         {
             ActionDead dead = new ActionDead(Owner);
             Owner.ActiveAction = dead;
         }
     }
     if (Owner.ActiveAction.IsFinish())
     {
         if (null == Owner.property.nextAction || !Owner.property.nextAction.IsCanActive())
         {
             if (Owner.property.isMainHero)
             {
                 if (null != Owner.property.target && Owner.property.target.property.isCanAttack && Owner.property.AutoAttack && !Owner.property.target.property.isDeadTemp && !Owner.property.CmdAutoAttack)
                 {
                     OperaAttack action = new OperaAttack(Owner);
                     action.IsPushStack = true;
                     KActiveSkill skill = KConfigFileManager.GetInstance().GetActiveSkill((uint)Owner.Job, 1);
                     if (null == skill)
                     {
                         return;
                     }
                     action.deltaSpace  = ((float)skill.CastRange) / 100f;
                     action.target      = Owner.property.target;
                     Owner.ActiveAction = action;
                 }
                 else
                 {
                     if (OperaWalking)
                     {
                         if (Owner.Position.x != Owner.property.finalDestination.x || Owner.Position.z != Owner.property.finalDestination.z)
                         {
                             ActionWalk action = new ActionWalk(Owner);
                             action.endPosition = Owner.property.finalDestination;
                             Owner.ActiveAction = action;
                             Owner.property.finalDestination = action.endPosition;
                         }
                         else
                         {
                             OperaWalking = false;
                             ActionIdle action = new ActionIdle(Owner);
                             Owner.ActiveAction = action;
                         }
                     }
                     else
                     {
                         ActionIdle action = new ActionIdle(Owner);
                         Owner.ActiveAction = action;
                     }
                 }
             }
             else
             {
                 if (Owner.Position.x != Owner.property.finalDestination.x || Owner.Position.z != Owner.property.finalDestination.z)
                 {
                     ActionWalk action = new ActionWalk(Owner);
                     action.beginPosition            = Owner.Position;
                     action.endPosition              = Owner.property.finalDestination;
                     action.speed                    = Owner.Speed;
                     Owner.ActiveAction              = action;
                     Owner.property.finalDestination = action.endPosition;
                 }
                 else
                 {
                     ActionIdle action = new ActionIdle(Owner);
                     Owner.ActiveAction = action;
                 }
             }
         }
         else
         {
             Owner.ActiveAction        = Owner.property.nextAction;
             Owner.property.nextAction = null;
         }
     }
     else
     {
         if (Owner.ActiveAction.actionType != Action.ACTION_TYPE.OPERA && !Owner.property.isMainHero)
         {
             if (
                 Mathf.Abs(Owner.Position.x - Owner.property.finalDestination.x) > 0.001f
                 ||
                 Mathf.Abs(Owner.Position.z - Owner.property.finalDestination.z) > 0.001f
                 )
             {
                 Owner.ActiveAction.TryFinish();
             }
         }
         Owner.ActiveAction.Update();
     }
     if (null != Owner.AidAction && !Owner.AidAction.IsFinish())
     {
         Owner.AidAction.Update();
     }
 }