public void PlayerDamage(float dam) { float tempD; if (!Blocking) { CurHP -= dam; if (dam > 0) { anim.Play("Player_hurt"); } } else { tempD = dam * BlockStr; if (CurSP < tempD) { CurHP -= tempD - CurSP; } SPDamage(tempD); } if (HPchange != null) { HPchange.Invoke(CurHP); } }
public void LoadCharacter() { SaveData data = SaveLoad.LoadGame(); if (!data.Equals(null)) { CurHP = data.curHP; CurSP = data.curSP; Lvl = data.lvl; Money = data.money; MaxHP = data.hpLvl; SpLvl = data.spLvl; StrLvl = data.strLvl; BlockLvl = data.blockLvl; MoneyLVL = (int)100 + 100 * Lvl / 5; MaxHP = 100 * HpLvl; MaxSP = 100 * SpLvl; PlayerD = 30 * StrLvl; BlockStr = 1 * BlockLvl; transform.position = new Vector3(data.position[0], data.position[1], data.position[2]); HPchange.Invoke(CurHP); SPchange.Invoke(CurSP); Mchange.Invoke(Money); } }