sorry dont know why it didnt get the top part of the script in.
Anyhow this script is to assign villagers diff jobs in the my game. Now everytime you activate a job it will
activate the proper tool for the job. The problem im having is once i add more than one villager all with the same script it only sets the items active and inactive on one villager. Can anyone please help me.
void Awake()
{
stonepick = GameObject.FindGameObjectWithTag("StonePick");
axeStone = GameObject.FindGameObjectWithTag("StoneAxe");
basket = GameObject.FindGameObjectWithTag("Basket");
wod = GetComponent<WoodCutter>();
gat = GetComponent<Gatherer>();
iron = GetComponent<IronMiner>();
con = GetComponent<Builder>();
WoodCutter = false;
Miner = false;
Gatherer = false;
Hunter = false;
Fisher = false;
Farmer = false;
builder = false;
Smith = false;
Doctor = false;
Priest = false;
Armorer = false;
Knight = false;
Scout = false;
Archer = false;
Infantry = false;
Leader= false;
KingsGuard = false;
Cook = false;
}
void Start()
{
gat.enabled = false;
wod.enabled = false;
iron.enabled = false;
con.enabled = false;
stonepick.SetActive(false);
basket.SetActive(false);
axeStone.SetActive(false);
}
void Update()
{
if(Gatherer == true)
{
gat.enabled = true;
basket.SetActive(true);
}
if (Gatherer == false)
{
gat.enabled = false;
basket.SetActive(false);
}
if (WoodCutter == true)
{
wod.enabled = true;
axeStone.SetActive(true);
}
if (WoodCutter == false)
{
wod.enabled = false;
axeStone.SetActive(false);
}
if (Miner == true)
{
iron.enabled = true;
stonepick.SetActive(true);
}
if (Miner == false)
{
iron.enabled = false;
stonepick.SetActive(false);
}
if (builder == true)
{
con.enabled = true;
}
if (builder == false)
{
con.enabled = false;
}
}
}