I wrote a collision and bullet damage script, bullet is tagged as bullet and both are rigid bodies plus both triggers are checked so i can't figure out why it isn't working?
using UnityEngine;
using System.Collections;
public class BulletDamage : MonoBehaviour {
public int HEALTH=100;
public GameObject bullet;
static public int bulletDamage = 25;
public GameObject clavicle;
public GameObject soldier;
void OnTriggerEnter(Collider other)
{
if(other.tag == "bullet");
{
HEALTH = HEALTH - bulletDamage;
}
if (HEALTH<=0)
{
clavicle.transform.parent = soldier.transform;
animation.Play("soldierDieFront");
}
}
}
↧