Permalink
Browse files

move hand position logic to player

  • Loading branch information...
1 parent 1a1c428 commit 373cc60c320703a23afb6c53a05acfb04e9ae6ee @bobrathgeber committed Oct 16, 2011
@@ -33,7 +33,7 @@ public override void play()
{
owner.Buys += 1;
owner.Coins += 1;
- owner.drawCard(1);
+ owner.pickupCard(1);
owner.moveCard(this, owner.hand, owner.discard);
}
}
@@ -33,7 +33,7 @@ public override void play()
if (owner.Actions > 0)
{
owner.Actions -= 1;
- owner.drawCard(2);
+ owner.pickupCard(2);
owner.moveCard(this, owner.hand, owner.discard);
}
}
@@ -32,7 +32,7 @@ public override void play()
if (owner.Actions > 0)
{
owner.Actions -= 1;
- owner.drawCard(3);
+ owner.pickupCard(3);
owner.moveCard(this, owner.hand, owner.discard);
}
}
@@ -37,7 +37,7 @@ public override void play()
if (owner.Actions > 0)
{
owner.Actions += 1;
- owner.drawCard(1);
+ owner.pickupCard(1);
owner.moveCard(this, owner.hand, owner.discard);
}
}
@@ -203,12 +203,8 @@ protected override void Draw(GameTime gameTime)
//draw cards in hand
for (int i=0; i<players[currentPlayer].hand.Count; i++)
{
- players[currentPlayer].hand[i].position.X = ((i * 140) + 20);
- players[currentPlayer].hand[i].position.Y = 600;
players[currentPlayer].hand[i].Draw(spriteBatch);
}
-
-
// Draw the infobar
spriteBatch.Draw(coinIcon, new Vector2(GraphicsDevice.Viewport.TitleSafeArea.X+5, GraphicsDevice.Viewport.TitleSafeArea.Y), Color.White);
@@ -60,7 +60,7 @@ public void playCard(int cardPosition)
//removes card @ cardPosition from hand
}
- public void drawCard(int numberOfCards)
+ public void pickupCard(int numberOfCards)
{
for(int n = 0; n < numberOfCards; n++)
{
@@ -75,9 +75,12 @@ public void drawCard(int numberOfCards)
discard.Clear();
shuffleDeck();
}
-
- hand.Add(deck[0]);
- deck.RemoveAt(0);
+ var card = deck[0];
+ deck.RemoveAt(0);
+
+ card.position.X = ((hand.Count * 140) + 20);
+ card.position.Y = 600;
+ hand.Add(card);
}
}
@@ -117,7 +120,7 @@ public void endTurn()
discard.Add(c);
hand.Remove(c);
}
- drawCard(5);
+ pickupCard(5);
actions = 1;
buys = 1;
coins = 0;
@@ -107,27 +107,27 @@
</Reference>
</ItemGroup>
<ItemGroup>
- <Compile Include="Classes\ActionCard.cs" />
+ <Compile Include="Classes\Cards\ActionCard.cs" />
<Compile Include="Classes\Button.cs" />
- <Compile Include="Classes\BuyCardAction.cs" />
+ <Compile Include="Classes\Actions\BuyCardAction.cs" />
<Compile Include="Classes\Card.cs" />
- <Compile Include="Classes\CopperCard.cs" />
- <Compile Include="Classes\DuchyCard.cs" />
- <Compile Include="Classes\EndTurnAction.cs" />
- <Compile Include="Classes\EstateCard.cs" />
- <Compile Include="Classes\GoldCard.cs" />
+ <Compile Include="Classes\Cards\CopperCard.cs" />
+ <Compile Include="Classes\Cards\DuchyCard.cs" />
+ <Compile Include="Classes\Actions\EndTurnAction.cs" />
+ <Compile Include="Classes\Cards\EstateCard.cs" />
+ <Compile Include="Classes\Cards\GoldCard.cs" />
<Compile Include="Classes\IButtonAction.cs" />
- <Compile Include="Classes\MarketCard.cs" />
- <Compile Include="Classes\MilitiaCard.cs" />
- <Compile Include="Classes\MoatCard.cs" />
- <Compile Include="Classes\NewGameAction.cs" />
+ <Compile Include="Classes\Cards\MarketCard.cs" />
+ <Compile Include="Classes\Cards\MilitiaCard.cs" />
+ <Compile Include="Classes\Cards\MoatCard.cs" />
+ <Compile Include="Classes\Actions\NewGameAction.cs" />
<Compile Include="Classes\Player.cs" />
- <Compile Include="Classes\ProvinceCard.cs" />
+ <Compile Include="Classes\Cards\ProvinceCard.cs" />
<Compile Include="Classes\Services.cs" />
- <Compile Include="Classes\SilverCard.cs" />
- <Compile Include="Classes\SmithyCard.cs" />
- <Compile Include="Classes\VillageCard.cs" />
- <Compile Include="Classes\WoodcutterCard.cs" />
+ <Compile Include="Classes\Cards\SilverCard.cs" />
+ <Compile Include="Classes\Cards\SmithyCard.cs" />
+ <Compile Include="Classes\Cards\VillageCard.cs" />
+ <Compile Include="Classes\Cards\WoodcutterCard.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Classes\Program.cs" />
<Compile Include="Classes\Game1.cs" />

0 comments on commit 373cc60

Please sign in to comment.