public void CommonAttack(SceneEntity hero) { 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 = hero; Owner.DispatchEvent(ControllerCommand.SetActiveAction, action); }
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(); } }
public override void DoUpdate() { int _listLen = SkillLogic.GetInstance().activeSkillList.Length; if (_listLen > skillList.Length) { skillList = new uint[_listLen - 1]; Array.Copy(SkillLogic.GetInstance().activeSkillList, 1, skillList, 0, _listLen - 1); } if (!Owner.property.CmdAutoAttack) { return; } if (Owner.ActiveAction.actionType == Action.ACTION_TYPE.FLY) { return; } if (Owner.ActiveAction.actionType == Action.ACTION_TYPE.ANIM) { if (Owner.ActiveAction is ActionMovingAOE) { ActionMovingAOE aoe = (ActionMovingAOE)Owner.ActiveAction; UpdateMoveAoe(aoe); return; } else { if (!Owner.ActiveAction.IsCanFinish()) { return; } } } else if (Owner.ActiveAction.actionType == Action.ACTION_TYPE.OPERA) { return; } if (!SelectAim()) { return; } int _len = skillList.Count(); if (_len > 0) { curIndex = curIndex % +_len; for (int i = 0; i < _len; i++) { uint skillId = skillList[curIndex]; try { if (!SkillLogic.GetInstance().RequestSkill((uint)skillId)) { curIndex = (curIndex + 1) % +_len; continue; } KSkillDisplay skillDisplay = KConfigFileManager.GetInstance().GetSkillDisplay(skillId, Owner.property.tabID); if (!Owner.ActiveAction.TryFinish()) { continue; } if (skillDisplay.Opera.CompareTo("TARGET") == 0) { SceneLogic.GetInstance().MainHero.Action.MoveAndSkill((ushort)skillId, Owner.property.target); Owner.property.AutoAttack = false; return; } else if (skillDisplay.Opera.CompareTo("NONE") == 0) { SceneLogic.GetInstance().MainHero.Action.MoveAndSkill((ushort)skillId, Owner.property.target); return; } else if (skillDisplay.Opera.CompareTo("TARGET_DIR") == 0) { SceneLogic.GetInstance().MainHero.Action.MoveAndSkill((ushort)skillId, Owner.property.target); Owner.property.AutoAttack = false; return; } } catch (NullReferenceException e) { } } } 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; EventDispatcher.GameWorld.DispatchEvent(ControllerCommand.CHANGE_TARGET); Owner.ActiveAction = action; Owner.property.AutoAttack = false; }