Skip to content
This repository has been archived by the owner on Oct 5, 2021. It is now read-only.

Commit

Permalink
Decrease swipe left/right sensitivity
Browse files Browse the repository at this point in the history
Close #2
  • Loading branch information
artem-bondar committed Nov 22, 2019
1 parent 4afc596 commit cac484d
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 12 deletions.
12 changes: 7 additions & 5 deletions Assets/Scenes/Game.unity
Original file line number Diff line number Diff line change
Expand Up @@ -6315,6 +6315,8 @@ MonoBehaviour:
keyRepeatRateLeftRight: 0.1
keyRepeatRateDown: 0.05
keyRepeatRateRotate: 0.05
swipeRepeatRateLeftRight: 0.25
swipeRepeatRateDown: 0.05
pausePanel: {fileID: 1968456175}
gameOverPanel: {fileID: 219639869}
rotateIconToggle: {fileID: 8032506584665241898}
Expand Down Expand Up @@ -8409,17 +8411,17 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: df620762fb420eb4e94b78a9dc9d7923, type: 3}
m_Name:
m_EditorClassIdentifier:
rowGlowFx:
- {fileID: 1931187394}
- {fileID: 361696489}
- {fileID: 1931183465}
- {fileID: 693649608}
emptySprite: {fileID: 5745196586078903165, guid: 6d0780b3676c55046ab0334565967d78,
type: 3}
height: 30
width: 10
header: 8
completedRows: 0
rowGlowFx:
- {fileID: 1931187394}
- {fileID: 361696489}
- {fileID: 1931183465}
- {fileID: 693649608}
--- !u!4 &2105124831
Transform:
m_ObjectHideFlags: 0
Expand Down
18 changes: 15 additions & 3 deletions Assets/Scripts/Managers/GameController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ public class GameController : MonoBehaviour
private float timeToNextKeyDown;
private float timeToNextKeyRotate;

private float timeToNextSwipeLeftRight;
private float timeToNextSwipeDown;

[Range(0.02f, 1)]
public float keyRepeatRateLeftRight = 0.1f;

Expand All @@ -31,6 +34,12 @@ public class GameController : MonoBehaviour
[Range(0.02f, 1)]
public float keyRepeatRateRotate = 0.05f;

[Range(0.02f, 1)]
public float swipeRepeatRateLeftRight = 0.25f;

[Range(0.02f, 1)]
public float swipeRepeatRateDown = 0.05f;

public GameObject pausePanel;
public GameObject gameOverPanel;

Expand Down Expand Up @@ -121,6 +130,7 @@ private void MoveRight()
{
activeShape.MoveRight();
timeToNextKeyLeftRight = Time.time + keyRepeatRateLeftRight;
timeToNextSwipeLeftRight = Time.time + swipeRepeatRateLeftRight;

if (!gameBoard.IsValidPosition(activeShape))
{
Expand All @@ -137,6 +147,7 @@ private void MoveLeft()
{
activeShape.MoveLeft();
timeToNextKeyLeftRight = Time.time + keyRepeatRateLeftRight;
timeToNextSwipeLeftRight = Time.time + swipeRepeatRateLeftRight;

if (!gameBoard.IsValidPosition(activeShape))
{
Expand Down Expand Up @@ -169,6 +180,7 @@ private void MoveDown()
{
timeToDrop = Time.time + dropIntervalModded;
timeToNextKeyDown = Time.time + keyRepeatRateDown;
timeToNextSwipeDown = Time.time + swipeRepeatRateDown;

if (activeShape)
{
Expand Down Expand Up @@ -214,15 +226,15 @@ private void PlayerInput()
{
MoveDown();
}
else if ((swipeDirection == Direction.right && Time.time > timeToNextKeyLeftRight) ||
else if ((swipeDirection == Direction.right && Time.time > timeToNextSwipeLeftRight) ||
swipeEndDirection == Direction.right)
{
MoveRight();

swipeDirection = Direction.none;
swipeEndDirection = Direction.none;
}
else if ((swipeDirection == Direction.left && Time.time > timeToNextKeyLeftRight) ||
else if ((swipeDirection == Direction.left && Time.time > timeToNextSwipeLeftRight) ||
swipeEndDirection == Direction.left)
{
MoveLeft();
Expand All @@ -236,7 +248,7 @@ private void PlayerInput()

swipeEndDirection = Direction.none;
}
else if (swipeDirection == Direction.down && Time.time > timeToNextKeyDown)
else if (swipeDirection == Direction.down && Time.time > timeToNextSwipeDown)
{
MoveDown();

Expand Down
1 change: 1 addition & 0 deletions ProjectSettings/GraphicsSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ GraphicsSettings:
- {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 16001, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 16003, guid: 0000000000000000f000000000000000, type: 0}
m_PreloadedShaders: []
m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000,
type: 0}
Expand Down
9 changes: 5 additions & 4 deletions ProjectSettings/ProjectSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ PlayerSettings:
16:10: 1
16:9: 1
Others: 1
bundleVersion: 1.0.0
bundleVersion: 1.0.1
preloadedAssets: []
metroInputSource: 0
wsaTransparentSwapchain: 0
Expand Down Expand Up @@ -165,9 +165,10 @@ PlayerSettings:
androidMaxAspectRatio: 2.1
applicationIdentifier:
Android: com.artembondar.solairetetris
Standalone: com.Company.ProductName
buildNumber: {}
AndroidBundleVersionCode: 1
Standalone: com.artembondar.solairetetris
buildNumber:
Standalone: 2
AndroidBundleVersionCode: 2
AndroidMinSdkVersion: 16
AndroidTargetSdkVersion: 0
AndroidPreferredInstallLocation: 1
Expand Down

0 comments on commit cac484d

Please sign in to comment.