private void _ToSkill(SkillDataWhole skillDataWhole) { if (skillDataWhole.m_eSkillKind == SkillEnum.SkillKind.Soul && m_CharData.SoulSkillInvalid.Value) { HUDTextMgr.GetInst().NewText(ConfigData.GetHUDText("16"), this, HUDTextMgr.HUDTextType.BUFF); //"技能失效" } m_CharData.m_iCurSkillID = skillDataWhole.m_iSkillID; OfficialShow(); int actionId = skillDataWhole.m_iActionID; if (-1 == actionId) { ExcuteSkill(0); Invoke("OfficialHide", 1f); } else { m_CharAnim.ToSkill(actionId); m_CharMove.StopAutoMove(); } if (skillDataWhole.m_eSkillKind == SkillEnum.SkillKind.Soul) { HUDTextMgr.GetInst().NewText(skillDataWhole.m_sDisplayName, this, HUDTextMgr.HUDTextType.MainSkillName); } else { HUDTextMgr.GetInst().NewText(skillDataWhole.m_sDisplayName, this, HUDTextMgr.HUDTextType.NormalSkillName); } }
//吸血 private void AbsorbHP(float hurt, CharHandler srcHandler) { float addHp = Mathf.Max(1f, hurt * srcHandler.m_CharData.AbsorbHP.Value); srcHandler.m_CharData.CurHP += addHp; HUDTextMgr.GetInst().NewText(string.Format("{0:N0}", addHp), srcHandler, HUDTextMgr.HUDTextType.AbsorbHP); }
//反弹伤害 private void Rebound(float hurt, CharHandler srcHandler) { float rebound = _charHandler.m_CharData.Rebound.Value; hurt *= rebound; srcHandler.BeHit(hurt, _charHandler, null, false); HUDTextMgr.GetInst().NewText(string.Format(ConfigData.GetHUDText("17"), hurt), _charHandler, HUDTextMgr.HUDTextType.BUFF); //"反弹伤害 {0:N0}" }
private void SkillAnimetor(Text text) { Sequence mySequence = DOTween.Sequence(); mySequence.AppendInterval(1f); mySequence.Append(text.DOFade(0, 0.2f)); mySequence.OnComplete(() => HUDTextMgr.GetInst().GetBackSkillText(this)); }
private void CheckRate(SkillDataWhole skillDataWhole, CharHandler charHandler, ref List <CharHandler> targets) { for (int i = targets.Count - 1; i >= 0; --i) { float rate = BattleCalculate.ExcuteFormula(skillDataWhole.m_sEffectRate, null, charHandler, targets[i]); if (Random.Range(0f, 1f) > rate) { HUDTextMgr.GetInst().NewText(ConfigData.GetValue("Lan_Battle_Client", "15", "Text"), targets[i], HUDTextMgr.HUDTextType.BUFF); //"释放不成功" targets.RemoveAt(i); } } }
protected bool CheckRate(SkillDataWhole skillDataWhole, CharHandler charHandler, CharHandler target) { float rate = BattleCalculate.ExcuteFormula(skillDataWhole.m_sEffectRate, null, charHandler, target); if (Random.Range(0f, 1f) > rate) { HUDTextMgr.GetInst().NewText(ConfigData.GetHUDText("15"), target, HUDTextMgr.HUDTextType.BUFF); //"释放不成功" return(false); } return(true); }
private static void _ChangeHP(CharHandler aimCharHandler, float fValue, CharHandler charHandler, SkillData skillData) { if (fValue <= 0) { aimCharHandler.BeHit(-fValue, charHandler, skillData.m_Parent); } else { fValue = Mathf.Max(1f, fValue * (1 + aimCharHandler.m_CharData.CureUpRatio - aimCharHandler.m_CharData.CureDownRatio)); HUDTextMgr.GetInst().NewText(string.Format("{0:N0}", fValue), aimCharHandler, HUDTextMgr.HUDTextType.AbsorbHP); aimCharHandler.m_CharData.CurHP += fValue; } }
private void TextAnimetor() { Sequence mySequence = DOTween.Sequence(); mySequence.Append(_textTrans.DOScale(Vector3.one * 2f, 0.1f)); mySequence.Append(_textTrans.DOScale(Vector3.one, 0.1f)); mySequence.AppendInterval(0.1f); mySequence.Append(_textTrans.DOLocalMoveY(_textTrans.localPosition.y + 30, 0.2f).SetEase(Ease.Linear)); mySequence.Join(m_text.DOFade(0.7f, 0.2f)); mySequence.Append(_textTrans.DOLocalMoveY(_textTrans.localPosition.y + 50, 0.2f).SetEase(Ease.Linear)); mySequence.Join(m_text.DOFade(0, 0.2f)); mySequence.OnComplete(() => HUDTextMgr.GetInst().GetBackText(this)); }
private static void _ChangeBool(CharHandler charHandler, CharHandler aimCharHandler, bool bFlag, TickData tickData, ChangeBoolFunc func, string beginText, string endText) { HUDTextMgr.GetInst().NewText(beginText, aimCharHandler, HUDTextMgr.HUDTextType.BUFF); func(aimCharHandler, bFlag); if (null != tickData) { tickData.funcTick = null; tickData.funcEnd += (bool bCancel) => { func(aimCharHandler, !bFlag); HUDTextMgr.GetInst().NewText(endText, aimCharHandler, HUDTextMgr.HUDTextType.BUFF); }; } }
private static void Concentrate(CharHandler aimCharHandler, TickData tickData) { HUDTextMgr.GetInst().NewText(ConfigData.GetHUDText("19"), aimCharHandler, HUDTextMgr.HUDTextType.BUFF); //"集火目标" aimCharHandler.m_CharData.Concentrate.AddNew(tickData.m_iInstanceID, true); if (null != tickData) { tickData.funcTick = null; tickData.funcEnd += (bool bCancel) => { aimCharHandler.m_CharData.Concentrate.Value = false; if (!aimCharHandler.m_CharData.Concentrate.Value) { HUDTextMgr.GetInst().NewText(ConfigData.GetHUDText("20"), aimCharHandler, HUDTextMgr.HUDTextType.BUFF); //"集火结束" } }; } }
private void Awake() { _gameObject = gameObject; BattleCam.rect = ApplicationConst.sceneCamRect; _inst = this; SceneLoader.LoadAddScene(m_sAddSceneName); _gameObject.AddComponent <HUDTextMgr>(); _gameObject.AddComponent <BattleSceneTimer>(); m_CharInScene = new BattleCharInScene(); m_TriggerManager = new BattleTriggerManager(); m_BattleScene = _gameObject.AddComponent <BattleScene>(); m_MPData = new MPData("Power1"); BattlePoolTrans.gameObject.AddComponent <BattleScenePool>(); HUDTextMgr.GetInst().HUDParent = HUDParentTran; HUDTextMgr.GetInst().HUDSkillParent = HUDSkillParentTran; }
public static float RatioCoefficient(float fValue, SkillEnum.SkillKind skillKind, CharHandler srcCharHandler, CharHandler aimCharHandler) { bool bSameSide = srcCharHandler.m_CharData.m_eSide == aimCharHandler.m_CharData.m_eSide; switch (skillKind) { case SkillEnum.SkillKind.Soul: fValue *= 1 + srcCharHandler.m_CharData.SoulSkillAtkRatio - (bSameSide ? 0 : aimCharHandler.m_CharData.SoulSkillDefRatio); //(1 + 攻方魂技提升 - 防方魂技免伤) break; case SkillEnum.SkillKind.Magic: fValue *= 1 + srcCharHandler.m_CharData.MagicSkillAtkRatio - (bSameSide ? 0 : aimCharHandler.m_CharData.MagicSkillDefRatio); //(1 + 攻方法术提升 - 防方法术免伤) break; default: fValue *= 1 + srcCharHandler.m_CharData.ForceSkillAtkRatio - (bSameSide ? 0 : aimCharHandler.m_CharData.ForceSkillDefRatio); //(1 + 攻方武功提升 - 防方武功免伤) //计算暴击格挡 float criticalRatio = srcCharHandler.m_CharData.CriticalRatio; float blockRatio = bSameSide ? 0 : aimCharHandler.m_CharData.BlockRatio; if (criticalRatio + blockRatio > 1) { criticalRatio = criticalRatio / (criticalRatio + blockRatio); blockRatio = 1 - criticalRatio; } float rand = Random.Range(0f, 1f); if (rand < criticalRatio) { fValue *= 2; //暴击 HUDTextMgr.GetInst().NewText(string.Format(ConfigData.GetHUDText("21"), fValue), aimCharHandler, HUDTextMgr.HUDTextType.NormalHit); //"暴击{0:N0}" } else if (rand - criticalRatio < blockRatio) { fValue = 0; //格挡 HUDTextMgr.GetInst().NewText(ConfigData.GetHUDText("22"), aimCharHandler, HUDTextMgr.HUDTextType.BUFF); //"格挡" } break; } return(fValue); }
private static void _AddValue(CharHandler charHandler, CharHandler aimCharHandler, float fValue, TickData tickData, AddValueFunc func, string beginText, string endText) { HUDTextMgr.GetInst().NewText(string.Format(beginText, fValue, fValue > 0 ? "+" : string.Empty), aimCharHandler, HUDTextMgr.HUDTextType.BUFF); func(aimCharHandler, fValue); if (null != tickData) { if (tickData.m_fUnitSec == tickData.m_fTotalSec) { tickData.funcTick = null; } else { tickData.funcTick = () => { func(aimCharHandler, fValue); } }; tickData.funcEnd += (bool bCancel) => { func(aimCharHandler, -fValue); HUDTextMgr.GetInst().NewText(string.Format(endText, fValue, fValue > 0 ? "-" : string.Empty), aimCharHandler, HUDTextMgr.HUDTextType.BUFF); }; } }
private void _BeHit(float hurt, CharHandler srcHandler, SkillDataSon srcSkillDataSon, bool bDirect) { _charHandler.m_CharData.CurHP -= hurt; if (bDirect) { CharHandler c; List <ConnectLine> connectList = BattleManager.GetInst().m_TriggerManager.GetConnectList(_charHandler.m_CharData.m_eSide); for (int i = 0; i < connectList.Count; ++i) { if (connectList[i].HasChar(_charHandler)) { for (int j = 0; j < connectList[i].m_lstCharHandler.Count; ++j) { c = connectList[i].m_lstCharHandler[j]; if (c == _charHandler) { continue; } c.BeHit(hurt * connectList[i].m_lstPercent[j], srcHandler, srcSkillDataSon, false); } } } } HPLosted(hurt, srcHandler, srcSkillDataSon); if (srcSkillDataSon == null) { HUDTextMgr.GetInst().NewText(Mathf.FloorToInt(0 - hurt).ToString(), _charHandler, HUDTextMgr.HUDTextType.NormalHit); } else { HUDTextMgr.GetInst().NewText(Mathf.FloorToInt(0 - hurt).ToString(), _charHandler, HUDTextMgr.HUDTextType.SkillHit); } }
//吸收伤害 private void Absorb(float hurt, CharHandler srcHandler) { float absorb = _charHandler.m_CharData.Absorb.Value; if (absorb < hurt) { float tmp = hurt - absorb; HUDTextMgr.GetInst().NewText(string.Format(ConfigData.GetHUDText("18"), absorb), _charHandler, HUDTextMgr.HUDTextType.BUFF); //"吸收伤害 {0:N0}" HUDTextMgr.GetInst().NewText((0 - tmp).ToString(), _charHandler, HUDTextMgr.HUDTextType.BUFF); _charHandler.m_CharTick.CancelAbsorb(); _charHandler.BeHit(tmp, srcHandler); } else if (absorb == hurt) { HUDTextMgr.GetInst().NewText(string.Format(ConfigData.GetHUDText("18"), hurt), _charHandler, HUDTextMgr.HUDTextType.BUFF); //"吸收伤害 {0:N0}" _charHandler.m_CharTick.CancelAbsorb(); } else { HUDTextMgr.GetInst().NewText(string.Format(ConfigData.GetHUDText("18"), hurt), _charHandler, HUDTextMgr.HUDTextType.BUFF); //"吸收伤害 {0:N0}" } _charHandler.m_CharData.Absorb.Value -= hurt; }