//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); } }
private void createActionArrow() { actionAimObj = new GameObject(gameObject.name + "_actionAimObj"); actionAimObj.transform.localPosition = new Vector3(0, 0, 0); actionAimArc = actionAimObj.AddComponent <lineArrow>() as lineArrow; actionAimArc.follow(gameObject.transform); actionAimArc.reticleMode = true; actionAimArc.setAngle(0); actionAimArc.hide(); }
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); }