private void HookFire() { if (PlayerConrollerInput.GetAlternativeFireButton() && !hookOn) { currentHook = Instantiate(grappleHook, anchorPosition.position, anchorPosition.rotation); //grab the hook projectile and set its andchor to the child position anchor of the player model. HookInstance hook = currentHook.GetComponent <HookInstance>(); //propel the hook forward. hook.SetHookInstance(this); hook.currentVelocity = speed * hook.transform.forward; hookOn = true; //flip the hook bool to true so that the object knows a hook exists in the world. } }
/// <summary> /// Registers the hook in the context. /// </summary> /// <param name="hook">The hook to register.</param> internal void RegisterHook(HookInstance hook) => Hooks.Add(hook);