Beispiel #1
0
    //This function controls the actionAim arrow
    public void actionAim(float h, float v)
    {
        checkForArrows();

        if (!hasAction || !hasActionAim)
        {
            return;
        }

        //Throw arc will take priority. If the user tries to throw while holding the action button down, we cancel the action aiming
        if (throwArc.isShowing())
        {
            actionAimArc.hide();
            return;
        }
        else
        {
            if (!actionAimArc.isShowing())
            {
                actionAimArc.show();
                //actionAimArc.setAngle(flippedX ? actionAimArc.angle : actionAimArc.angle );
                actionAimArc.setMinMax(flippedX ? minAimFlipped : minAimNotFlipped, flippedX ? maxAimFlipped : maxAimNotFlipped);
            }

            actionAimArc.setAngle(actionAimArc.angle += (flippedX ? -v : v));
            actionAimArc.setLength(actionAimArc.length + h);

            if (rotateWithAim)
            {
                gameObject.transform.eulerAngles = new Vector3(0f, 0f, flippedX ? actionAimArc.angle + 180 : actionAimArc.angle);
            }
        }
    }
Beispiel #2
0
    //Use the throwing retical. Called by the holding object.
    //Arguments = Horizontal movement, vertical movement, release and throw, use the object's action
    public void Aim(float h, float v, bool release, bool action)
    {
        checkForArrows();

        if (hasAction && hasActionAim)
        {
            if (actionAimArc != null)
            {
                actionAimArc.hide();
            }
        }

        if (!throwArc.isShowing())
        {
            throwArc.show();
            throwArc.setAngle(flippedX ? 130 : 50);
            //throwArc.setMinMax(flippedX ? 0 : 90, flippedX ? 90 : 180);
            throwArc.setMinMax(flippedX ? minAimFlipped : minAimNotFlipped, flippedX ? maxAimFlipped : maxAimNotFlipped);
        }
        if (release)
        {
            throwItem();
        }
        else
        {
            throwArc.setAngle(throwArc.angle += (flippedX ? -v : v));
            throwArc.setLength(throwArc.length + h);
        }
    }