Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add automatic card flip #97

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/dotnet-core.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: .NET Core

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.301
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Test
run: dotnet test --no-restore --verbosity normal
9 changes: 8 additions & 1 deletion src/GameLogic/Snap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public class Snap
public Snap ()
{
_deck = new Deck ();
_gameTimer = SwinGame.CreateTimer ();
}

/// <summary>
Expand Down Expand Up @@ -92,6 +93,7 @@ public void Start()
_deck.Shuffle (); // Return the cards and shuffle

FlipNextCard (); // Flip the first card...
_gameTimer.Start();
}
}

Expand All @@ -111,7 +113,11 @@ public void FlipNextCard()
/// </summary>
public void Update()
{
//TODO: implement update to automatically slip cards!
if (_gameTimer.Ticks > _flipTime)
{
_gameTimer.Reset ();
FlipNextCard ();
}//automatically slip cards!
}

/// <summary>
Expand Down Expand Up @@ -143,6 +149,7 @@ public void PlayerHit (int player)

// stop the game...
_started = false;
_gameTimer.Stop ();
}

#region Snap Game Unit Tests
Expand Down
3 changes: 2 additions & 1 deletion src/SnapGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ private static void HandleUserInput(Snap myGame)
if (SwinGame.KeyTyped (KeyCode.vk_SPACE))
{
myGame.FlipNextCard ();
myGame.Start ();
}
}

Expand Down Expand Up @@ -86,4 +87,4 @@ public static void Main()
}
}
}
}
}