public void NormalAttackStart() { this.normalAttackComboInfo.nextTime = CombatUtil.GetTime() + ComboConst.Normal_Attack_Combo_Max_Duration; // 1秒间隔触发combo this.normalAttackComboInfo.nextIndex = this.normalAttackComboInfo.nextIndex + 1; this.isNormalAttacking = true; }
public (bool, bool) Attack(List <Unit> targetUnitList, bool isNoNormalAttack) { //先尝试释放技能 if (CombatUtil.GetTime() - this.lastUseSkillTime >= this.useSkillInterval) { for (int i = 0; i < this.unit.skillIdList.Count; i++) { this.useSkillNextIndex = this.useSkillNextIndex + 1; if (this.useSkillNextIndex >= this.unit.skillIdList.Count) { this.useSkillNextIndex = 0; } var skillId = this.unit.skillIdList[this.useSkillNextIndex]; //如果当前技能不能施放,则放下一个。 //且保存着已经施放技能index在self.use_spell_next_index, //以使每个技能都有机会施放 if (this.TryCastSkill(skillId, targetUnitList).Item1) { //成功施放了技能才记录最后一次使用技能的时间,以保证三个技能都不能施放时, //下一帧继续尝试施放 this.lastUseSkillTime = CombatUtil.GetTime(); return(true, false); } } } if (isNoNormalAttack) { return(false, false); } //再尝试普攻 return(this.TryNormalAttack(targetUnitList)); }
public string GetNormalAttackId() { var nextIndex = this.normalAttackComboInfo.nextIndex; if (CombatUtil.GetTime() > this.normalAttackComboInfo.nextTime || !this.normalAttackIdList.ContainsIndex(this.normalAttackComboInfo.nextIndex) ) { nextIndex = 0; } var normalAttackId = this.normalAttackIdList[nextIndex]; return(normalAttackId); }
protected void PlaySpellAnimation(Vector3?faceToPosition = null) { if (this.cfgSpellData.animation_duration > 0) { this.__animationTimePct = 0; this.__animationStartTime = CombatUtil.GetTime(); } if (!this.cfgSpellData.animation_name.IsNullOrWhiteSpace()) { if (faceToPosition == null && this.targetUnit != null) { faceToPosition = this.targetUnit.GetPosition(); } // 不转向 if (this.cfgSpellData.is_not_face_to_target) { faceToPosition = null; } float speed = this.cfgSpellData.type == "普攻" ? this.sourceUnit.GetCalcPropValue("攻击速度") : 1; this.sourceUnit.PlayAnimation(this.cfgSpellData.animation_name, null, speed, faceToPosition, this.cfgSpellData.is_can_move_while_cast); } }
public void NormalAttackFinish() { this.normalAttackComboInfo.nextTime = CombatUtil.GetTime() + 0.2f; this.isNormalAttacking = true; }
public void Init(Unit unit) { base.Init(); this.unit = unit; this.lastUseSkillTime = CombatUtil.GetTime(); }