Hello everyone. My problem is as follows :
I have 3 Diferent Java scripts
First Sript name i just call is “PlayerHp”, Second Script Name is “PlayerSkill”, Third script Name PlayerStats
PlayerHp:
static var curHp = 80;
static var dieHp = 0;
static var maxHp = 100;
PlayerSkill:
var damageHp = 10;
private var curHp = PlayerHp.curHp;
private var dieHp = PlayerHp.dieHp;
private var maxHp = PlayerHp.maxHp;
function Update() {
if(Input.GetButton("Attack") && curHp > dieHp) {
curHp = curHp - damageHp;
Debug.Log ("Hp" + curHp);
}
PlayerStats:
public var curHp = PlayerHp.curHp;
public var dieHp = PlayerHp.dieHp;
public var maxHp = PlayerHp.maxHp;
but when made some change by PlayerSkill (for example pressing Input.GetButton(“Attack”), then the stats made change the didn’t update to playerHp or PlayerStats. How can i fix that?