I used my knowledge so far to make a one bullet enemy damage system which is really just silly,because it has no realism or it doesnt make any sense to kill my enemy so fast.So I have made 2 new script which I want to use as enemy health/damage system for multiple guns.I only have this so far:
Enemyhp script:
var hp :int;
function die(){
Debug.Log("Enemy Killed");
}
function OnCollisionEnter (col : Collision)
{
if(col.gameObject.tag == "Bullet")
{
}
}
And my bullet damage script:
var damage:int;
function DoDamage(){
}
function OnCollisionEnter (col : Collision)
{
if(col.gameObject.tag == "Enemy");
{
DoDamage();
}
}
}
My question is,how would I change the enemy hp by getting the values of the hp and reduce it?And how would I check if my enemy has 0 hp left?