Beispiel #1
0
    /*  void StartGrapple()
     * {
     *    if (grapplingState == GrapplingState.Normal)
     *    {
     *        GameObject close;
     *
     *        if (Physics.Raycast(cameraTransform.position, cameraTransform.forward, out grappleHit, maxDistance, whatIsGrappleable))
     *        {
     *            showRope = true;
     *            lr.positionCount = 2;
     *            autoAim = false;
     *            aimPoint.transform.position = grappleHit.point;
     *            aimPoint.SetActive(true);
     *            StartGrappleHelper(grappleHit.collider.gameObject);
     *            grapplePoint = grappleHit.point;
     *        }
     *        else if (playerControl.GetGrapplingAutoAimStatus() && (close = FindGrapplePoint()) != null)
     *        {
     *            // should i make it actually shoot to the player
     *            showRope = true;
     *            lr.positionCount = 2;
     *            autoAim = true;
     *            aimPoint.transform.position = close.transform.position;
     *            aimPoint.SetActive(true);
     *            StartGrappleHelper(close.gameObject);
     *            grapplePoint = lastGrapple.transform.position;
     *        }
     *    }
     *    else
     *    {
     *        aimPoint.SetActive(false);
     *    }
     * } */

    void StartGrappleHelper(GameObject g)
    {
        grapplingState = GrapplingState.Grappling;

        // Wait for the counter to hit zero before the grapple takes place.
        ropeShootCounter = ropeShootLength;

        // Only animate the hands if you shoot the grappling gun.
        handsAnimator.ResetTrigger("StopGrappling");
        handsAnimator.SetTrigger("Grappling");
        soundManager.PlayGrapplingSound();
        lastGrapple = g;
        g.GetComponent <MeshRenderer>().material.SetColor("_EmissionColor", neonGreen * 0.0150f);

        crosshair.ChangeCrossHairColor();
    }