public IEnumerator IEStartSkill(BattleRoleData source, BattleRoleData target) { source.playMoveTowardAnimation(target.unit_model.position); yield return(new WaitForSeconds(moveTowardAndBackTime)); source.unit_character_model.CurrentCharacterModel.ChangeModelAnim (source.unit_character_model.CurrentCharacterModel.anim_attack, false); SLEffectManager.Instance.playCommonEffectSlash(target.transform.position); yield return(new WaitForSeconds(SDConstants.AnimTime_ATTACK - hitTime)); int damage = dmgCaused(source, target); #region 计算技能状态 source.SkillCheck(this, target); IsCausedCritDmg = source.CritHappen; IsCausedMiss = !source.AccurHappen; IsCausedFault = source.FaultHappen; if (IsCausedCritDmg) { float criD = AllRandomSetClass.SimplePercentToDecimal (source.ThisBasicRoleProperty().CRIDmg + 100); damage = (int)(damage * criD); } int NowExpect = (int)(UnityEngine.Random.Range(-1f, 1f) * source.ExpectResult); #endregion damage += NowExpect; #region 输技能状态 target.HpController.isCriDmg = IsCausedCritDmg; target.HpController.isEvoHappen = IsCausedMiss; target.HpController.isFault = IsCausedFault; #endregion damage = (int)(damage * AllRandomSetClass.SimplePercentToDecimal(100 + target.PhysModify)); Debug.Log(source.name + " slash cause " + damage + " damage to " + target.name); target.HpController.getDamage(damage, SkillKind.Physical); yield return(new WaitForSeconds(hitTime)); //yield return new WaitForSeconds(skillLastTime); source.unit_character_model.CurrentCharacterModel.ChangeModelAnim (source.unit_character_model.CurrentCharacterModel.anim_idle, true); source.playMoveBackAnimation(); yield return(new WaitForSeconds(moveTowardAndBackTime)); StartCoroutine(IEWaitForEnd(source)); }
public IEnumerator IEStartSkill(BattleRoleData source, BattleRoleData target, NumberData _val) { source.playMoveTowardAnimation(target.unit_model.position); yield return(new WaitForSeconds(moveTowardAndBackTime)); // source.unit_character_model.CurrentCharacterModel.ChangeModelAnim (source.unit_character_model.CurrentCharacterModel.anim_attack, false); SLEffectManager.Instance.playCommonEffectSlash(target.transform.position); yield return(new WaitForSeconds(SDConstants.AnimTime_ATTACK - hitTime)); // float r = 0; if (_val.dataTag == NumberData.DataType.integer) { r = AllRandomSetClass.SimplePercentToDecimal(_val.DATA); } else { r = _val.DECIMAL; } //目标敌人级别越高成功率越低 int level = target.ThisBasicRoleProperty().LEVEL; for (int i = 0; i < level; i++) { r *= 0.8f; } // if (UnityEngine.Random.Range(0, 1) < r)//捕获成功 { SDDataManager.Instance.AddSlave(target.ThisBasicRoleProperty().ID); target.HpController.FadeAndDisappear(); } source.unit_character_model.CurrentCharacterModel.ChangeModelAnim (source.unit_character_model.CurrentCharacterModel.anim_idle, true); source.playMoveBackAnimation(); yield return(new WaitForSeconds(moveTowardAndBackTime)); StartCoroutine(IEWaitForEnd(source)); }