public void PivotAround() { Vector3 center = PlayerController.Instance.transform.localPosition; var toCursorVector = ControlUtility.GetPlayerToCursorVector(); var lookRotation = Quaternion.LookRotation(toCursorVector); transform.SetPositionAndRotation(center, lookRotation); if (this.dontTurnIndicatorOn | this.renderer.sharedMaterial.Equals(this.indicatorMat)) { return; } //this.image.SetActive(true); this.renderer.sharedMaterial = this.indicatorMat; }
private void LeftClick() { if (!Input.GetMouseButtonDown(0)) { return; } // if attack indicator is directly on an enemy, set it as target; otherwise find the closest enemy from the cursor and then set it as the target if (this.attackIndicator.On) { this.attackIndicator.TurnOff(); bool cursorOnHittable = this.RaycastAtMousePoint(this.hittableHitResults, 1 << 10); if (cursorOnHittable) { this.Target = this.hittableHitResults[0].transform; } else { this.Target = ControlUtility.GetClosestEnemyFromCursor(); } } }