private void OnCollisionExit2D(Collision2D collision) { HookableBase h = collision.gameObject.GetComponent <HookableBase>(); if (h == AttachedHookable) { DisAttachHook(); ChangeMode(HookMode.FishingPole); } else { Debug.LogError("How did this happen? --> Touched another hookable when already hooked on another hookable."); } }
private void OnCollisionEnter2D(Collision2D collision) { if (AttachedHookable == false) { HookableBase h = collision.gameObject.GetComponent <HookableBase>(); if (h) { AttachHook(h); } else if (collision.gameObject.layer == 10) { // collided with player if (Mode != HookMode.InitialThrow) { OnHookFullyRetracted(); } } } }
private void DisAttachHook() { AttachedHookable.RemoveHook(this); AttachedHookable = null; }
private void AttachHook(HookableBase hookable) { AttachedHookable = hookable; AttachedHookable.AddHook(this); }