private void OnTriggerEnter2D(Collider2D collision) { if (hookState == HookState.RETURNING && collision.gameObject.tag == "Player") { foreach (Transform child in transform) { NPCController npc = child.GetComponent <NPCController> (); if (npc != null) { npc.AddPointToScore(); } } ResetHook(); } if (hookState == HookState.IN_USE) { //Debug.Log ( "I've hit: " + collision.gameObject.name ); //if ( collision.gameObject.tag == "NPC" ) { // collision.GetComponent<NPCController> ().ChildToTransform ( transform ); //} else if ( collision.gameObject.tag != "Player" && collision.GetComponent<ObjectDestroyer>() == null ) { // StopAllCoroutines (); // StartCoroutine ( ReturnHook () ); //} if (collision.tag != "Player" && collision.GetComponent <ObjectDestroyer> () == null) { if (collision.gameObject.tag == "NPC") { collision.GetComponent <NPCController> ().ChildToTransform(transform); } StopAllCoroutines(); StartCoroutine(ReturnHook()); } } }