コード例 #1
0
    public void InitPlayersFromFile()
    {
        for (int i = 1; i < playerDataLines.Length; i++)
        {
            string[] row = playerDataLines[i].Split(new char[] { ',' });

            // create temp player
            Data_Player_Main newPlayer = new Data_Player_Main();

            // use player counter as id
            newPlayer.playerId = Data_Player_Main.playerCount;

            newPlayer.name = row[0];
            newPlayer.team = row[1];
            int.TryParse(row[2], out newPlayer.age);
            int.TryParse(row[3], out newPlayer.currentAbility);
            int.TryParse(row[4], out newPlayer.potentialAbility);

            PlayerPosition tempPos = (PlayerPosition)System.Enum.Parse(typeof(PlayerPosition), row[5]);
            newPlayer.position = tempPos;

            // add player to global player list
            players.Add(newPlayer);
        }
    }
コード例 #2
0
 public void SetPlayerData(Data_Player_Main data)
 {
     player_data = data;
 }