public void EndSwing() { if (hookAround) { MomentumHandler playerMomentum = GetComponent <MomentumHandler>(); if (playerMomentum.connected) { onSwing = false; playerBod.useGravity = true; playerBod.isKinematic = false; playerMomentum.connected = false; playerMomentum.swinging = false; playerBod.velocity = playerMomentum.currentVel.magnitude * playerMomentum.releaseVector.normalized * 1.5f; Destroy(currentHook); hookAround = false; jumpOn = 0; anotherJump = true; StartCoroutine(FallHandle(true)); } else { Destroy(currentHook); hookAround = false; } } }
public SKTouchHandler(Action <SKTouchEventArgs> onTouchAction, Func <double, double, SKPoint> scalePixels) { this.onTouchAction = onTouchAction; this.scalePixels = scalePixels; momentumHandler = new MomentumHandler(this); }