示例#1
0
    public void StartGrapple()
    {
        if (currentHook == null || Grappling)
        {
            return;
        }

        Grappling      = true;
        Latched        = false;
        hookRigidbody  = currentHook.rigidbody;
        latchTotalTime = (currentHook.transform.position - ropeEffectSource.position).magnitude / latchSpeed;
        latchTime      = 0;
        //obstacleTime = 0;
        reelIn         = false;
        normalizedTilt = Vector3.zero;

        armHookTransform.SetParent(null, true);

        ClearRopeEffect();
        ropeEffect = Instantiate(ropeEffectPrefab, ropeEffectSource.position, Quaternion.identity, ropeEffectSource);
        ropeEffect.SetTravelTime(latchTotalTime);

        if (hookLaunch != null)
        {
            hookLaunch.Play(transform.position);
        }
    }
示例#2
0
 private void ClearRopeEffect()
 {
     if (ropeEffect)
     {
         Destroy(ropeEffect.gameObject);
         ropeEffect = null;
     }
 }