can someone help me I need to change these two classes I found out that I need to change the _jake.exp and these two classes
where in java but I am trying convert them to c# I got some of it its just that _jake.exp that is giving me error so can someone show me
how these two should look and these classes are part of a rpg that I am making.:
using UnityEngine;
using System.Collections;
public class Controller : MonoBehaviour{
public PlayerStats _jake;
void Start(){
_jake = GetComponent<PlayerStats>();
_jake.level = 3;
_jake.name = "Jake";
_jake.STR = 50;
_jake.DEX = 55;
_jake.DEF = 50;
_jake.vital = 100;
_jake.Magic = 60;
_jake.luck = 45;
_jake.Speed = 56;
_jake.Agility = 46;
_jake.exp = 0;
}
}
public class PlayerStats : Controller {
public int level;
public string name;
public Stat Hp = new Stat();
public Stat Mp = new Stat();
public int STR;
public int DEX;
public int DEF;
public int vital;
public int Magic;
public int luck;
public int Speed;
public int Agility;
public int melee;
public int ranged;
public int MagA;
public int MagD;
public float active;
public Stat exp = new Stat();
public void addexp(int ex){
exp.Cur += ex;
while(exp.Cur >= exp.Max level < 99){
exp.Cur -= exp.Max;
exp.Max = level *(level+1)* 500;
level++;
upstats();
}
}
void upstats(){
STR++;
DEX++;
DEF++;
vital++;
Magic++;
luck++;
Speed++;
Agility++;
melee =(level*7)+STR;
ranged =(level*7)+DEX;
DEF =(level*2)+ Agility;
MagA =(level*7)+ Magic;
MagD =(level*2)+ luck;
active =20+((Speed * level)/1500);
Hp.Max =((level * 5)+ vital)*10;
Hp.Cur = Hp.Max;
Mp.Max =((level * 5)+ Magic)*10;
Mp.Cur = Mp.Max;
}
public class Stat{
public int Cur;
public int Max;
}
public PlayerStats(int level,string name,int STR,int DEX,int DEF,int vital,int Magic,int luck,int speed,int Agility,int exp){
this.level = 1;
this.name = name;
this.STR = STR;
this.DEF = DEF;
this.vital = vital;
this.Magic = Magic;
this.luck = luck;
this.Speed = speed;
this.Agility = Agility;
addexp(exp);
}
}