Alright In my game ive used numbers for the majority of things for the moment. (Ammo, Health etc) and now decided to make a kill counter.
I used the same method for all of them though with my kill counter after one kill from 0 it goes to 1 as it should but after another kill it does not go to 2 but it stays at 1. It is probably something small that I am doing incorrectly.
Heres current parts of my script that are to do with the kill counter
public float killcount = 0f;
if (zombiehealth <= 0)
{
killcounter();
removeZombie();
}
if (zombiehealth <= 1)
{
print("kill count is now: "+killcount);
GameObject.Find("g_Killcount").guiText.text = ""+killcount;
}
As you can see there is an un needed zombiehealth <= 1 there, that is just me trying to work things out.
void killcounter () // killcounter
{
killcount += 1;
}
void removeZombie () // removes the zombie
{
if (thisIsPlayer == false)
{
Instantiate(ptrScriptVariable.parZombieDeath, transform.position, Quaternion.identity );
} else {
Instantiate(ptrScriptVariable.parPlayerDeath, transform.position, Quaternion.identity );
}
Destroy(gameObject);
}
I originally had killcount() code inside removeZombie but moved it to help me work things out.
I think it is something to do with my += 1; but I cannot use + 1 because I get errors or is it just me failing.