コード例 #1
0
 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.
     }
 }
コード例 #2
0
 public void UseHook(Vector3 playerVelocity, float gravity, bool isGrounded)
 {
     if (canUseHook && PlayerConrollerInput.GetAlternativeFireButton())
     {
         HookFire();
     }
     //if the hook is latched check for other user input.
     if (hookIn && canUseHook)
     {
         HookControls();                                    //Check for user hook input
         HookBehavior(playerVelocity, gravity, isGrounded); //Check for hook behaviour
     }
 }