private void OnTriggerEnter(Collider other) { if (layerToDetect.value == (layerToDetect.value | (1 << other.gameObject.layer))) { Vector3 forcehit = new Vector3(); if (other.transform.position.x > transform.position.x) { forcehit.x = force.x; forcehit.y = force.y; forcehit.z = force.z; } else { forcehit.x = -force.x; forcehit.y = force.y; forcehit.z = force.z; } //Debug.Log("Switch type = " + thisHitDetectType + "parent is " + parent.name); switch (thisHitDetectType) { case HitDetectType.GivesDamage: overlapper = other.gameObject.GetComponent <HitDetect>(); if (alwaysDoDamage) { overlapper.AlwaysDoDamageToParent(damage, forcehit); } else { if (isActive) { overlapper.DoDamageToParent(damage, forcehit); } } overlapping = true; Debug.Log("hit " + damage + " " + other.gameObject.GetComponent <Character>().Health); break; case HitDetectType.TakesDamage: break; case HitDetectType.AlertsEnemy: parent.Alert(); break; case HitDetectType.ForgetEnemy: break; case HitDetectType.SetCheckpoint: other.gameObject.GetComponent <Player>().SetNewCheckpoint(transform.position); break; default: break; } } }