public void ComboAttack(int index, Units target) { if (this.self.CanAttack && !this.isComboAttack) { this.isComboAttack = true; Skill attackByIndex = this.self.getAttackByIndex(index); if (attackByIndex != null) { if (target == null) { target = this.self.GetAttackTarget(); } attackByIndex.attackTarget = target; if (attackByIndex.CheckCondition() && attackByIndex.CheckTargets() && !base.IsCurAttackRunnning()) { attackByIndex.Start(); attackByIndex.OnSkillStartCallback = new Callback <Skill>(base.OnAttackStart); attackByIndex.OnSkillEndCallback = new Callback <Skill>(base.OnAttackEnd); base.CurAttack = attackByIndex; this.UpdateCurAttackIndex(); } } this.isComboAttack = false; } }
/// <summary> /// Launches skill casting to a fixed position target /// </summary> public void CastSkill(Skill skill, Vector3 target) { if (!CanCastSkill(skill)) { return; } // skill is passive - cant cast it if (skill is PassiveSkill) { return; } // reuse check if (!skill.CanUse()) { Message("Skill is not yet available for use.", 2); return; } if (skill is ActiveSkill) { ((ActiveSkill)skill).Start(target); } else { skill.Start(); } }
/// <summary> /// Launches skill casting to a fixed gameobject target /// </summary> public void CastSkill(Skill skill, GameObject setTarget = null, bool noTarget = false) { if (!CanCastSkill(skill)) { return; } // skill is passive - cant cast it if (skill is PassiveSkill) { return; } // reuse check if (!skill.CanUse()) { Message("Skill is not yet available for use.", 2); return; } if (skill is ActiveSkill) { if (noTarget) { ((ActiveSkill)skill).Start(); } else { if (setTarget == null) { ((ActiveSkill)skill).Start(GetData().Target); } else { ((ActiveSkill)skill).Start(setTarget); } } } else { skill.Start(); } }
private void ComboAttack(int index, Units target) { if (!this.isComboAttack) { this.isComboAttack = true; Skill attackByIndex = this.self.getAttackByIndex(index); if (target == null) { target = this.self.GetAttackTarget(); } attackByIndex.attackTarget = target; if (attackByIndex.CheckTargets()) { attackByIndex.Start(); attackByIndex.OnSkillStartCallback = new Callback <Skill>(base.OnAttackStart); attackByIndex.OnSkillEndCallback = new Callback <Skill>(base.OnAttackEnd); base.CurAttack = attackByIndex; } this.isComboAttack = false; } }
public override void Conjure(string skillId, Units target = null, Vector3?targetPos = null) { if (this.self.CanSkill && !this.isConjure) { this.isConjure = true; this.self.InterruptAction(SkillInterruptType.Initiative); Skill skillById = this.self.getSkillById(skillId); if (target == null) { target = this.self.GetAttackTarget(); } skillById.attackTarget = target; skillById.attackPosition = targetPos; if (skillById.CheckCondition() && skillById.CheckTargets()) { skillById.Start(); skillById.OnSkillStartCallback = new Callback <Skill>(base.OnSkillStart); skillById.OnSkillEndCallback = new Callback <Skill>(base.OnSkillEnd); base.currSkill = skillById; } this.isConjure = false; } }
public void Conjure_Impl(string skillId, Units target, Vector3?targetPos, bool isPvp = false) { Skill skillById = this.self.getSkillById(skillId); if (SkillUtility.IsBurnUnitSkill(skillById) && targetPos.HasValue) { Units touchUnit = ManualControlTarget.GetTouchUnit(targetPos.Value); if (touchUnit != null && (touchUnit.GetType() == typeof(Tower) || touchUnit.GetType() == typeof(Home))) { base.OnSkillFailedBeforeStart(skillById); ClientLogger.Warn(string.Concat(new object[] { "不能摆蘑菇在这里", touchUnit, " ", targetPos.Value })); return; } } if (this.self.CanSkill || skillById.CheckSkillCanUseSpecial) { if (target == null && !targetPos.HasValue) { target = this.self.GetAttackTarget(); } skillById.attackTarget = target; skillById.attackPosition = targetPos; if (skillById.CheckCondition() && skillById.CheckTargets()) { if (isPvp) { UseSkillInfo useSkillInfo = new UseSkillInfo { unitId = this.self.unique_id, skillId = skillById.skillMainId, targetUnit = (!(skillById.attackTarget != null)) ? 0 : skillById.attackTarget.unique_id, targetPosition = (!skillById.attackPosition.HasValue) ? null : MoveController.Vector3ToSVector3(skillById.attackPosition.Value), targetRotate = this.self.transform.eulerAngles.y }; PvpEvent.SendUseSkill(useSkillInfo); this.sendUseSkills[skillId] = true; this.sendUseSkillTicks[skillId] = DateTime.Now.Ticks; this.self.moveController.clearContinueMovingTarget(); if (GlobalSettings.Instance.ClientGoAhead) { List <Units> list = new List <Units>(); if (target != null) { list.Add(target); } ActionManager.ReadySkill(new SkillDataKey(useSkillInfo.skillId, skillById.skillLevel, 0), this.self, list, skillById.attackPosition, skillById, false); } } else { this.self.InterruptAction(SkillInterruptType.Initiative); skillById.OnSkillStartCallback = new Callback <Skill>(base.OnSkillStart); skillById.OnSkillEndCallback = new Callback <Skill>(base.OnSkillEnd); skillById.OnSkillFailedBeforeStartCallback = new Callback <Skill>(base.OnSkillFailedBeforeStart); skillById.Start(); base.currSkill = skillById; } } else { base.OnSkillFailedBeforeStart(skillById); } } }
public void ComboAttack_Impl(int index, Units target, bool isPvp = false) { Skill attackByIndex = this.self.getAttackByIndex(index); if (this.self.CanAttack && !this.isComboAttack) { if (attackByIndex == null) { base.OnAttackFailedBeforeStart(null); return; } this.isComboAttack = true; if (target == null) { target = this.self.GetAttackTarget(); } attackByIndex.attackTarget = target; if (attackByIndex.CheckCondition() && attackByIndex.CheckTargets()) { if (!base.IsCurAttackRunnning() && this.self.CanAttack) { if (isPvp) { UseSkillInfo useSkillInfo = new UseSkillInfo { unitId = this.self.unique_id, skillId = attackByIndex.skillMainId, targetUnit = (!(target != null)) ? 0 : target.unique_id, targetPosition = (!(target != null)) ? null : MoveController.Vector3ToSVector3(target.transform.position), targetRotate = this.self.transform.eulerAngles.y }; PvpEvent.SendUseSkill(useSkillInfo); this.sendUseSkills[attackByIndex.skillMainId] = true; this.sendUseSkillTicks[attackByIndex.skillMainId] = DateTime.Now.Ticks; this.self.moveController.clearContinueMovingTarget(); if (GlobalSettings.Instance.ClientGoAhead) { List <Units> list = new List <Units>(); if (target != null) { list.Add(target); } ActionManager.ReadySkill(new SkillDataKey(useSkillInfo.skillId, attackByIndex.skillLevel, 0), this.self, list, null, attackByIndex, false); } } else { attackByIndex.Start(); attackByIndex.OnSkillStartCallback = new Callback <Skill>(base.OnAttackStart); attackByIndex.OnSkillEndCallback = new Callback <Skill>(base.OnAttackEnd); attackByIndex.OnSkillFailedBeforeStartCallback = new Callback <Skill>(base.OnAttackFailedBeforeStart); base.CurAttack = attackByIndex; this.self.playVoice("onNormalAttack"); this.IncComboIndex(); } } } else { base.OnAttackFailedBeforeStart(attackByIndex); } this.isComboAttack = false; } else { base.OnAttackFailedBeforeStart(null); } }