void OnTriggerEnter(Collider other) { // Debug.Log ("ontrigger"); if (other.tag == "Enemy") { float tempHP; normal = GameObject.Find("Normal Enemy(Clone)").GetComponent <FootmanController> (); hp -= normal.damage; tempHP = hp / 5; bloodLine.transform.localScale = new Vector3(tempHP, 2f, 0.3f); Destroy(other.gameObject); } if (other.tag == "HeavyEnemy") { float tempHP; heavy = GameObject.Find("Heavy Enemy(Clone)").GetComponent <HeavyEnemyController> (); hp -= heavy.damage; tempHP = hp / 5; bloodLine.transform.localScale = new Vector3(tempHP, 2f, 0.3f); Destroy(other.gameObject); } if (other.tag == "QuickEnemy") { float tempHP; quick = GameObject.Find("Quick Enemy(Clone)").GetComponent <QuickEnemyController> (); hp -= quick.damage; tempHP = hp / 5; bloodLine.transform.localScale = new Vector3(tempHP, 2f, 0.3f); Destroy(other.gameObject); } }
// Start is called before the first frame update void Start() { heavyEnemyController = GetComponentInParent <HeavyEnemyController>(); damageToPlayer = heavyEnemyController.damageToPlayer; }