private void ChangePlayerAttrOfLevel(int level) { Cfg_Level levelCfg = Cfg_Level.GetCfg(level); Attr.Attack += levelCfg.AddAttack; Attr.Blood += levelCfg.AddBlood; Attr.Defense += levelCfg.AddDefense; }
private float IfCanLevelUp(float value) { Cfg_Level cfg_Level = Cfg_Level.GetCfg(Level); if (value >= cfg_Level.NeedExp) { Level = Level + 1; return(value - cfg_Level.NeedExp); } else { return(value); } }
void SetExpSlider(float exp, float addExp = 0f) { GameObject obj = AddExpText.gameObject; obj.SetActive(false); if (addExp != 0) { GameObject _obj = Instantiate(obj, obj.transform.parent); _obj.GetComponent <Text>().text = Mathf.FloorToInt(addExp).ToString("+#;-#;0"); _obj.SetActive(true); } ExpText.text = Mathf.Floor(exp).ToString() + "/" + Cfg_Level.GetCfg(PlayerData.Level).NeedExp; ExpSlider.value = exp / Cfg_Level.GetCfg(PlayerData.Level).NeedExp; }
private void PracticeAddExp() { Timer timer = Timer.CreateTimer("Practice"); int interval = COMMON.PracticeInterval; timer.StartTiming(interval, delegate() { if (PlayerData.IsStartPractice) { Cfg_Level cfg_Level = Cfg_Level.GetCfg(PlayerData.Level); PlayerDataChange.AddExp(cfg_Level.AddExp); } }, true); //每隔一段时间获得一次经验,需要先开启修炼,受资质影响 }
void SetLevelText(int level) { LevelText.text = Cfg_Level.GetCfg(level).Name; }