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); } }
private void ClearRopeEffect() { if (ropeEffect) { Destroy(ropeEffect.gameObject); ropeEffect = null; } }