Exemplo n.º 1
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);
        }
    }
Exemplo n.º 2
0
    public void setActionAimAngleTowardsPoint(Vector3 point)
    {
        if (!hasAction || !hasActionAim)
        {
            return;
        }
        actionAimArc.setMinMax(flippedX ? minAimFlipped : minAimNotFlipped, flippedX ? maxAimFlipped : maxAimNotFlipped);
        float angle = Mathf.Atan2(point.y - transform.position.y + offset.y, point.x - transform.position.x + offset.x) * 180 / Mathf.PI;

        if (angle < -90)
        {
            angle += 360;
        }

        actionAimArc.setAngle(angle);
    }