use ball radius

main
Benjamin Kraft 1 year ago
parent 64665997a4
commit 78be656b18
  1. 24
      Assets/Scenes/Game.unity
  2. 6
      Assets/Scripts/Game/AIPlayer.cs

@ -648,7 +648,7 @@ SpriteRenderer:
m_FlipX: 0 m_FlipX: 0
m_FlipY: 0 m_FlipY: 0
m_DrawMode: 2 m_DrawMode: 2
m_Size: {x: 28.636364, y: 35} m_Size: {x: 20, y: 35}
m_AdaptiveModeThreshold: 0.5 m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0 m_SpriteTileMode: 0
m_WasSpriteAssigned: 1 m_WasSpriteAssigned: 1
@ -723,7 +723,7 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
isUpdating: 1 isUpdating: 1
panelHeightPixelsMinimum: 200 panelHeightPixelsMinimum: 250
playGroundSize: {x: 20, y: 35} playGroundSize: {x: 20, y: 35}
emptySpaceHeight: 3 emptySpaceHeight: 3
mainCamera: {fileID: 1698696476} mainCamera: {fileID: 1698696476}
@ -735,12 +735,6 @@ MonoBehaviour:
playerPanelTop: {fileID: 738870617} playerPanelTop: {fileID: 738870617}
playerPanelBottom: {fileID: 2108734120} playerPanelBottom: {fileID: 2108734120}
background: {fileID: 712762093} background: {fileID: 712762093}
top: 17.5
bottom: -17.5
left: -10
right: 10
boardTop: 14.5
boardBottom: -14.5
--- !u!1001 &1166615026 --- !u!1001 &1166615026
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -943,7 +937,7 @@ Camera:
far clip plane: 1000 far clip plane: 1000
field of view: 60 field of view: 60
orthographic: 1 orthographic: 1
orthographic size: 25.454546 orthographic size: 27.6875
m_Depth: 0 m_Depth: 0
m_CullingMask: m_CullingMask:
serializedVersion: 2 serializedVersion: 2
@ -1016,11 +1010,11 @@ PrefabInstance:
m_Modifications: m_Modifications:
- target: {fileID: 4540566536649322900, guid: b4033513367475439bfcd048b5d376a6, type: 3} - target: {fileID: 4540566536649322900, guid: b4033513367475439bfcd048b5d376a6, type: 3}
propertyPath: m_Size.x propertyPath: m_Size.x
value: 28.636364 value: 20
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 4540566536649322900, guid: b4033513367475439bfcd048b5d376a6, type: 3} - target: {fileID: 4540566536649322900, guid: b4033513367475439bfcd048b5d376a6, type: 3}
propertyPath: m_Size.y propertyPath: m_Size.y
value: 7.954546 value: 10.1875
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 4540566536649322901, guid: b4033513367475439bfcd048b5d376a6, type: 3} - target: {fileID: 4540566536649322901, guid: b4033513367475439bfcd048b5d376a6, type: 3}
propertyPath: m_Name propertyPath: m_Name
@ -1036,7 +1030,7 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 4540566536649322903, guid: b4033513367475439bfcd048b5d376a6, type: 3} - target: {fileID: 4540566536649322903, guid: b4033513367475439bfcd048b5d376a6, type: 3}
propertyPath: m_LocalPosition.y propertyPath: m_LocalPosition.y
value: -21.477272 value: -22.59375
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 4540566536649322903, guid: b4033513367475439bfcd048b5d376a6, type: 3} - target: {fileID: 4540566536649322903, guid: b4033513367475439bfcd048b5d376a6, type: 3}
propertyPath: m_LocalPosition.z propertyPath: m_LocalPosition.z
@ -1155,11 +1149,11 @@ PrefabInstance:
m_Modifications: m_Modifications:
- target: {fileID: 4540566536649322900, guid: b4033513367475439bfcd048b5d376a6, type: 3} - target: {fileID: 4540566536649322900, guid: b4033513367475439bfcd048b5d376a6, type: 3}
propertyPath: m_Size.x propertyPath: m_Size.x
value: 28.636364 value: 20
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 4540566536649322900, guid: b4033513367475439bfcd048b5d376a6, type: 3} - target: {fileID: 4540566536649322900, guid: b4033513367475439bfcd048b5d376a6, type: 3}
propertyPath: m_Size.y propertyPath: m_Size.y
value: 7.954546 value: 10.1875
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 4540566536649322901, guid: b4033513367475439bfcd048b5d376a6, type: 3} - target: {fileID: 4540566536649322901, guid: b4033513367475439bfcd048b5d376a6, type: 3}
propertyPath: m_Name propertyPath: m_Name
@ -1175,7 +1169,7 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 4540566536649322903, guid: b4033513367475439bfcd048b5d376a6, type: 3} - target: {fileID: 4540566536649322903, guid: b4033513367475439bfcd048b5d376a6, type: 3}
propertyPath: m_LocalPosition.y propertyPath: m_LocalPosition.y
value: 21.477272 value: 22.59375
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 4540566536649322903, guid: b4033513367475439bfcd048b5d376a6, type: 3} - target: {fileID: 4540566536649322903, guid: b4033513367475439bfcd048b5d376a6, type: 3}
propertyPath: m_LocalPosition.z propertyPath: m_LocalPosition.z

@ -66,8 +66,8 @@ namespace Game {
// TODO Also must include fact that players have a height, maybe check the incoming angle // TODO Also must include fact that players have a height, maybe check the incoming angle
// angle: 0 -> perpendicular, from -90 to 90 // angle: 0 -> perpendicular, from -90 to 90
private bool IsPositionReachableInTime(float futurePosition, float seconds, float angle) { private bool IsPositionReachableInTime(float futurePosition, float seconds, float radius, float angle) {
float requiredDistance = Mathf.Abs(futurePosition - X) - Width / 2; float requiredDistance = Mathf.Abs(futurePosition - X) - Width / 2 - radius;
if (requiredDistance < 0) if (requiredDistance < 0)
return true; return true;
if (Mathf.Abs(futurePosition) > Border) if (Mathf.Abs(futurePosition) > Border)
@ -96,7 +96,7 @@ namespace Game {
// Horizontal line (player line) -> stop simulating // Horizontal line (player line) -> stop simulating
if (Intersect(origin, end, playerLeft, playerRight, out Vector2 point, out Vector2 rs)) { if (Intersect(origin, end, playerLeft, playerRight, out Vector2 point, out Vector2 rs)) {
secondsUsed += secondsLeft * rs.x; secondsUsed += secondsLeft * rs.x;
if (!IsPositionReachableInTime(point.x, secondsUsed, Vector2.Angle(velocity, transform.up))) if (!IsPositionReachableInTime(point.x, secondsUsed, radius, Vector2.Angle(velocity, transform.up)))
ignore = true; ignore = true;
return point.x; return point.x;
} }

Loading…
Cancel
Save