예제 #1
0
파일: Player.cs 프로젝트: shatram193/Arcana
 //Default constructor, for testing purposes.
 public Player()
 {
     playerNumber = 1;
     playerBox = new PlayerBox();
     db = null;
     hand = new Dictionary<string, Card>();
     hand.Add("card", new Card(new Vector2(375, 0)));
 }
예제 #2
0
파일: Player.cs 프로젝트: shatram193/Arcana
 //Parameter: int playerNumber - the number assigned to the player
 //Parameter: DatabaseLink db - the class that possesses the
 //link to the database for card loading purposes.
 public Player(int playerNumber, DatabaseLink db)
 {
     this.playerNumber = playerNumber;
     playerBox = new PlayerBox(playerNumber, health);
     //Chooses the location of the player's hand.
     Vector2 position = (this.playerNumber == 1) ? new Vector2(375, 0) : new Vector2(375, 550);
     this.db = db;
     //"Select" in the DatabaseLink class returns an array of lists of strings.
     //We here parse the list of strings into its component database entries
     //and add those to the player's hand.
     List<string>[] availableCards = db.Select(playerNumber);
     hand = new Dictionary<string, Card>();
     List<string> names = availableCards[0];
     List<string> powers = availableCards[1];
     int i = 0;
     foreach (string name in names)
     {
         string power = powers[i++];
         hand.Add(name, new Card(position, name, Int32.Parse(power)));
     }
 }