private void OnTriggerEnter(Collider collider) { GameObject colliderObject = collider.gameObject; IsPlayer isPlayerScript = colliderObject.GetComponent <IsPlayer>(); if (isPlayerScript == null) { return; } m_obstacleScript.GetLevelOptions().Die(); m_obstacleScript.DestroySelf(); }
private void OnTriggerEnter(Collider collider) { IsObstacle obstacleScript = (IsObstacle)Utility.GetComponentInParents <IsObstacle>(collider.transform);// collider.GetComponent<IsObstacle>(); if (obstacleScript == null) { return; } obstacleScript.DestroySelf(); }