private void UpdatePlayerTargetFromScreenInputPosition(Vector2 screenPosition) { if (Time.time - previousInputUpdateTime > InputRefreshRate) { float inputPlaneWidth = 40.0f; float inputPlaneHeight = 40.0f; Vector2[] inputPoints = SMath.GetDiscretePlanePointsFromCentrePoint(screenPosition, inputPlaneWidth, inputPlaneHeight, 10); if (PlayerObject != null) { PlayerController controller = PlayerObject.GetComponent <PlayerController>(); Vector2 screenPoint = screenPosition; for (int i = 0; i < inputPoints.Length; ++i) { if (ScreenPointChangesPlayerTarget(inputPoints[i], controller)) { return; } } if (controller != null) { controller.ClearTargetPosition(); } } previousInputUpdateTime = Time.time; } }