diff --git a/Assets/Scripts/Game/AIPlayer.cs b/Assets/Scripts/Game/AIPlayer.cs index 23e6f2a..6ef5133 100644 --- a/Assets/Scripts/Game/AIPlayer.cs +++ b/Assets/Scripts/Game/AIPlayer.cs @@ -67,8 +67,9 @@ namespace Game { } private float IdlePosition => Difficulty >= Difficulty.Medium ? 0 : X(); + + private float DistortAmount => 1 - 1 / ((float) Difficulty + 1); - // TODO solution for balls outside of border // TODO Also must include fact that players have a height, maybe check the incoming angle // angle: 0 -> perpendicular, from -90 to 90 private bool IsPositionReachableInTime(float futurePosition, float seconds, float angle) { @@ -151,9 +152,13 @@ namespace Game { float radius = ball.Radius; float target = Simulate(origin, velocity, radius, FutureSeconds, 0, out bool impossible); - if (!impossible) - return target; - + if (!impossible) { + float max = Width / 2; + float distortionOffset = DistortAmount * max; + distortionOffset *= target > X() ? -1 : 1; + return target + distortionOffset; + } + approaching.Remove(ball); // This ball was impossible to catch, try next one } @@ -163,7 +168,7 @@ namespace Game { private float currentSmoothV; private void ApproachPosition(float pos) { - float result = Mathf.SmoothDamp(X(), pos, ref currentSmoothV, .5f, Speed); + float result = Mathf.SmoothDamp(X(), pos, ref currentSmoothV, .2f, Speed); transform.position = new Vector2(result, Y()); ClampInsideBorders(); } diff --git a/Assets/Scripts/Game/GameManager.cs b/Assets/Scripts/Game/GameManager.cs index b9fe7d2..016b6db 100644 --- a/Assets/Scripts/Game/GameManager.cs +++ b/Assets/Scripts/Game/GameManager.cs @@ -54,7 +54,7 @@ namespace Game { private void Start() { Settings.Type = Type.Hybrid; - Settings.AIDifficulty = Difficulty.Easy; + Settings.AIDifficulty = Difficulty.VeryEasy; var ball = Instantiate(ballPrefab).GetComponent(); Balls.Add(ball);