void OnTriggerEnter(Collider other)//i will need to add this code to a common class for all damage dealing things. possibly damagaeType? { GameObject topLevel = damageType.HitCollider(other, ownerName, team, damage); if (topLevel.name != ownerName) { var blast = (GameObject)Instantiate(blastHit, transform.position, transform.rotation); blast.transform.SetParent(topLevel.transform); Destroy(blast, 01f); Destroy(gameObject); } }
protected void LineCheck(Vector3 startPosition, float Length, Vector3 dir) { // do a line check, damage everything with health in the line. startPosition += transform.position; Vector3 endPosition = startPosition + (dir * Length); RaycastHit[] Hits; Hits = Physics.RaycastAll(startPosition, endPosition); foreach (RaycastHit rH in Hits) { damageType.HitCollider(rH.collider, name, team, damage); } }