Пример #1
0
    public IEnumerator DeactivatePunishmentCards_TwoActiveCardsOneToDeactivate()
    {
        //Tests that if there is an active card owned by the player, it becomes deactivated when deactivatePunishmentCards is called.
        Setup();
        //Give the player two punishment cards
        Player player1 = players [0];

        Card card1 = new FreshersFluCard(player1);
        Card card2 = new NothingCard(player1);

        player1.AddPunishmentCard(card1);
        player1.AddPunishmentCard(card2);

        //Activate cards
        cardDeck.GetActiveCards().Add(card1);
        cardDeck.GetActiveCards().Add(card2);

        card1.SetTurnCount(2);          //Card will not be deactivated this turn...
        card2.SetTurnCount(1);          //...But this one will.

        cardDeck.DeactivatePunishmentCards(player1);

        //Test that card1 is still active.
        Assert.Contains(card1, cardDeck.GetActiveCards());
        Assert.AreEqual(1, card1.GetTurnCount());
        Assert.AreSame(player1, card1.GetOwner());

        //Test that card2 has been deactivated.
        Assert.IsFalse(cardDeck.GetActiveCards().Contains(card2));
        Assert.Zero(card2.GetTurnCount());
        Assert.IsNull(card2.GetOwner());
        yield return(null);
    }
Пример #2
0
    public IEnumerator FreshersFluCard_ActivatePunishment_RemovesBonuses()
    {
        //Tests that FreshersFluCard removes the bonuses from the players who do not own the card played.
        Setup();
        yield return(null);

        Player testPlayer = players [0];
        Card   testCard   = new FreshersFluCard(testPlayer);

        //Give the players bonuses;
        players [0].SetBeer(2);
        players [0].SetKnowledge(1);
        players [1].SetBeer(3);
        players [1].SetKnowledge(1);
        players [2].SetBeer(3);
        players [2].SetKnowledge(2);
        players [3].SetBeer(4);

        testCard.activatePunishment();          //activate the punishment

        Assert.AreEqual(2, testPlayer.GetBeer());
        Assert.AreEqual(1, testPlayer.GetKnowledge());

        for (int i = 1; i < 4; i++)
        {
            Assert.Zero(players [i].GetBeer());
            Assert.Zero(players [i].GetKnowledge());
        }
    }
Пример #3
0
    public IEnumerator ShowMenu_OneCardPlayableOneCardNot()
    {
        //Tests that if the current player owns a card that has not been activated, it will appear in a card slot.
        //Tests that if the current player owns a card that has been activated by another player, it will be disabled.
        Setup();
        yield return(null);

        cardDeck.SetActiveCard(new FreshersFluCard(null));           //Activate a FreshersFluCard
        Player testPlayer = game.currentPlayer;

        testPlayer.GetPunishmentCards().Clear();           //Ensure testPlayer has no cards.

        //Give the testPlayer two cards; One Nothing and one FreshersFlu
        Card card1 = new NothingCard(testPlayer);
        Card card2 = new FreshersFluCard(testPlayer);

        testPlayer.AddPunishmentCard(card1);
        testPlayer.AddPunishmentCard(card2);

        cardDeck.ShowMenu();          //Show the card deck menu

        List <GameObject> cardSlots = cardDeck.GetCardSlots();

        //Test if the card images have been added to card slots
        Assert.AreEqual(card1.cardImage, cardSlots [0].GetComponent <Image> ().sprite);
        Assert.AreEqual(card2.cardImage, cardSlots [1].GetComponent <Image> ().sprite);

        //Test if card1's slot is enabled and card2's slot is disabled.
        Assert.IsTrue(cardSlots[0].GetComponent <Button>().IsInteractable());
        Assert.IsFalse(cardSlots [1].GetComponent <Button> ().IsInteractable());

        cardDeck.HideMenu();          //Hide the menu to reset the test scene.
    }
Пример #4
0
    public IEnumerator FreshersFluCard_DeactivatePunishment_ReturnsBonuses()
    {
        //Tests that FreshersFluCard correctly restores the bonuses.
        Setup();
        game.InitializeMap();
        yield return(null);

        Player testPlayer = players [0];
        Card   testCard   = new FreshersFluCard(testPlayer);

        List <int> bonuses = new List <int> ();

        for (int i = 1; i < 4; i++)
        {
            bonuses.Add(players [i].GetBeer());
            bonuses.Add(players [i].GetKnowledge());
        }

        testCard.activatePunishment();          //activate the punishment
        testCard.deactivatePunishment();        //deactivate the punishment

        //Test that the bonuses have been returned to normal for all "enemy" players.
        for (int i = 1; i < 4; i++)
        {
            Assert.AreEqual(bonuses [0], players [i].GetBeer());
            bonuses.Remove(bonuses [0]);
            Assert.AreEqual(bonuses [0], players [i].GetKnowledge());
            bonuses.Remove(bonuses [0]);
        }
    }
Пример #5
0
    public IEnumerator FreshersFluCard_DeactivatePunishment_RecalculatesBonusesIfLandmarkCaptured()
    {
        //Tests that FreshersFluCard correctly recalculates the bonuses, which can be caused by players capturing landmarks
        //while the card is active.
        Setup();
        game.InitializeMap();
        yield return(null);

        Player testPlayer = players [0];
        Card   testCard   = new FreshersFluCard(testPlayer);

        Player player2 = players [1];
        int    player2InitialKnowledgeBonus = player2.GetKnowledge();

        //Create a new landmark sector that will be captured by player2 once the FreshersFluCard is played.
        Landmark newLandmark = new GameObject("TestLandmark").AddComponent <Landmark> ();

        newLandmark.SetResourceType(Landmark.ResourceType.Knowledge);
        player2.ownedSectors [0].GetAdjacentSectors() [0].SetLandmark(newLandmark);

        testCard.activatePunishment();
        player2.Capture(player2.ownedSectors [0].GetAdjacentSectors() [0]);           //Capture the new landmark.
        testCard.deactivatePunishment();

        Assert.AreEqual(player2InitialKnowledgeBonus + 2, player2.GetKnowledge());
    }
Пример #6
0
    public IEnumerator DeactivatePunishmentCards_TwoActiveCardsToDeactivate()
    {
        //Tests that if there is an active card owned by the player, it becomes deactivated when deactivatePunishmentCards is called.
        Setup();
        //Give the player two punishment cards
        Player player1 = players [0];

        Card card1 = new FreshersFluCard(player1);
        Card card2 = new NothingCard(player1);

        player1.AddPunishmentCard(card1);
        player1.AddPunishmentCard(card2);

        //Activate cards
        cardDeck.GetActiveCards().Add(card1);
        cardDeck.GetActiveCards().Add(card2);

        card1.SetTurnCount(1);
        card2.SetTurnCount(1);

        cardDeck.DeactivatePunishmentCards(player1);

        //Test that both cards have been deactivated.
        foreach (Card card in new Card[] { card1, card2 })
        {
            Assert.IsFalse(cardDeck.GetActiveCards().Contains(card));
            Assert.Zero(card.GetTurnCount());
            Assert.IsNull(card.GetOwner());
        }

        yield return(null);
    }
Пример #7
0
    public void AssignPunishmentCard(Player player)
    {
        //This method is used to give 'player' a new punishment card.

        int randInt = Random.Range(0, 100);

        if (randInt < 25)
        {
            Card lecturerStrikeCard = new LecturerStrikeCard(player);
            player.AddPunishmentCard(lecturerStrikeCard);
            return;
        }
        if (randInt < 50)
        {
            Card nothingCard = new NothingCard(player);
            player.AddPunishmentCard(nothingCard);
            return;
        }
        if (randInt < 75)
        {
            Card killerHangoverCard = new KillerHangoverCard(player);
            player.AddPunishmentCard(killerHangoverCard);
            return;
        }
        if (randInt < 100)
        {
            Card freshersFluCard = new FreshersFluCard(player);
            player.AddPunishmentCard(freshersFluCard);
            return;
        }
    }
Пример #8
0
    public IEnumerator AddPunishmentCard_DoesNotAddCardIfCardIsNotOwnedByPlayer()
    {
        //Tests that cards are not added to a player's punishmentCards list if the player does not own the card.
        GameObject playerObject1 = new GameObject("TestPlayer_1");
        GameObject playerObject2 = new GameObject("TestPlayer_2");
        Player     currentPlayer = playerObject1.AddComponent <Player> ();
        Player     otherPlayer   = playerObject2.AddComponent <Player> ();

        Card testCard = new FreshersFluCard(otherPlayer);

        currentPlayer.AddPunishmentCard(testCard);                           //Try to add the testCard.

        Assert.False(currentPlayer.GetPunishmentCards().Contains(testCard)); //Test whether testCard has been added or not.
        yield return(null);
    }
Пример #9
0
    public IEnumerator SetActiveCard_AddsCardToActiveCardList()
    {
        //Tests that SetActiveCard correctly adds cards to the activeCards list.
        cardDeck = MonoBehaviour.Instantiate(Resources.Load <GameObject> ("PunishmentCardGUI")).GetComponent <CardDeck> ();
        //Create two new cards
        Card card1 = new NothingCard(null);
        Card card2 = new FreshersFluCard(null);

        cardDeck.GetActiveCards().Clear();                 //Clear the active card list
        cardDeck.SetActiveCard(card1);                     //Add card1
        Assert.Contains(card1, cardDeck.GetActiveCards()); //Has card1 been added?

        cardDeck.SetActiveCard(card2);                     //Add card2
        Assert.Contains(card1, cardDeck.GetActiveCards()); //Is card1 still active?
        Assert.Contains(card2, cardDeck.GetActiveCards()); //Has card2 been added?
        yield return(null);
    }
Пример #10
0
    public IEnumerator ComputerPlayPunishmentCard_CardPlayed()
    {
        //Tests to see if ComputerPlayPunishmentCard correctly plays a card.
        Setup();
        game.SetTurnState(Game.TurnState.Move1);
        //Add a test card to the current player.
        Player testPlayer = game.currentPlayer;
        Card   testCard   = new FreshersFluCard(testPlayer);

        testPlayer.AddPunishmentCard(testCard);

        testPlayer.ComputerPlayPunishmentCard();          //Try to play a card.

        //Test if testCard has been played
        Assert.Contains(testCard, cardDeck.GetActiveCards());
        Assert.IsFalse(testPlayer.GetPunishmentCards().Contains(testCard));
        Assert.AreEqual(Game.TurnState.EndOfTurn, game.GetTurnState());
        yield return(null);
    }
Пример #11
0
    public void AssignPunishmentCard(Player player)
    {
        //gives the player a new punishment card.

        int randInt = Random.Range(0, 100);

        if (randInt < 50)
        {
            Card nothingCard = new NothingCard(player);
            player.AddPunishmentCard(nothingCard);
            return;
        }
        if (randInt < 100)
        {
            Card freshersFluCard = new FreshersFluCard(player);
            player.AddPunishmentCard(freshersFluCard);
            return;
        }
    }
Пример #12
0
    public IEnumerator ActivateCard_CardIsTakenFromPlayerAndActivated()
    {
        //Tests if the ActivateCard method correctly activates the card, removes it from the player's ownership and ends the turn.
        Setup();
        yield return(null);

        game.SetTurnState(Game.TurnState.Move1);          //Ensure turnState is Move1.
        //Give player1 a punishment card.
        Player player1  = game.currentPlayer;
        Card   testCard = new FreshersFluCard(player1);

        player1.AddPunishmentCard(testCard);

        cardDeck.ShowMenu();                                             //Initialize player1's cardDeck.
        cardDeck.ActivateCard(cardDeck.GetCardSlots()[0]);               //Activate the card

        Assert.Contains(testCard, cardDeck.GetActiveCards());            //Test that testCard has been added to the active list.
        Assert.IsFalse(player1.GetPunishmentCards().Contains(testCard)); //Test that the card has been removed from the player's card list
        Assert.AreEqual(Game.TurnState.EndOfTurn, game.GetTurnState());  //Test that the turn has finished.
    }
Пример #13
0
    public IEnumerator AddPunishmentCard_DoesNotAddCardIfListIsFull()
    {
        //Tests that the card is not added to a player's punishmentCards list if it already contains 5 cards.
        GameObject playerObject = new GameObject("TestPlayer");
        Player     testPlayer   = playerObject.AddComponent <Player> ();

        testPlayer.GetPunishmentCards().Clear();           //Ensure list is clear.
        //Give the player 5 cards.
        for (int i = 0; i < 5; i++)
        {
            testPlayer.GetPunishmentCards().Add(new NothingCard(testPlayer));
        }

        Card testCard = new FreshersFluCard(testPlayer);

        testPlayer.AddPunishmentCard(testCard);                           //Try to add the testCard.

        Assert.False(testPlayer.GetPunishmentCards().Contains(testCard)); //Test whether testCard has been added or not.
        yield return(null);
    }
Пример #14
0
    public IEnumerator FreshersFluCard_ActivatePunishment_StoresPvcBonuses()
    {
        //Test that activate punishment correctly stores the amount of extra bonus gained from the PVC.
        Setup();
        game.InitializeMap();
        yield return(null);

        Player          testPlayer = players [0];
        FreshersFluCard testCard   = new FreshersFluCard(testPlayer);

        Player player2 = players [1];

        player2.SetKnowledge(player2.GetKnowledge() + 4);          //Give player2 an extra 4 knowledge points.

        testCard.activatePunishment();

        Dictionary <Player, int[]> pvcBonuses = testCard.GetPvcBonuses();

        Assert.AreEqual(0, pvcBonuses [player2] [0]);
        Assert.AreEqual(4, pvcBonuses [player2] [1]);
    }
Пример #15
0
    public IEnumerator RemoveActiveCard_RemovesCardFromActiveCards()
    {
        //Tests that RemoveActiveCard correctly removes cards from the activeCards list.
        cardDeck = MonoBehaviour.Instantiate(Resources.Load <GameObject> ("PunishmentCardGUI")).GetComponent <CardDeck> ();

        //Create two new cards
        Card card1 = new NothingCard(null);
        Card card2 = new FreshersFluCard(null);

        cardDeck.GetActiveCards().Clear();                       //Clear the active card list
        cardDeck.SetActiveCard(card1);                           //Add card1
        cardDeck.SetActiveCard(card2);                           //Add card2

        cardDeck.RemoveActiveCard(card1);                        //Remove card1
        Assert.Contains(card2, cardDeck.GetActiveCards());       //Is card2 still active?
        Assert.False(cardDeck.GetActiveCards().Contains(card1)); //Has card1 been removed?

        cardDeck.RemoveActiveCard(card2);                        //Remove card2
        Assert.AreEqual(0, cardDeck.GetActiveCards().Count);     //Test that the list is empty

        yield return(null);
    }
Пример #16
0
    public IEnumerator ComputerPlayPunishmentCard_MakesNormalMoveWhenAllCardsOwnedAreActive()
    {
        //Tests that the AI makes a normal move if ComputerPlayPunishmentCard is called when all of the cards
        //owned by the AI are already active in the game.
        Setup();
        game.InitializeMap();

        //Activate a NothingCard and a FreshersFluCard.
        cardDeck.SetActiveCard(new NothingCard(null));
        cardDeck.SetActiveCard(new FreshersFluCard(null));

        Player testPlayer         = game.currentPlayer;
        Sector unitsInitialSector = testPlayer.units [0].GetSector();
        Card   testCard1          = new NothingCard(testPlayer);
        Card   testCard2          = new FreshersFluCard(testPlayer);

        //Add the testCards to the testPlayer
        testPlayer.AddPunishmentCard(testCard1);
        testPlayer.AddPunishmentCard(testCard2);

        testPlayer.ComputerPlayPunishmentCard();     //Try to play a punishment card.

        yield return(new WaitForSeconds(1));         //wait for the player to make their move.

        int    numberOfOwnedSectors = testPlayer.ownedSectors.Count;
        Sector unitsNewSector       = testPlayer.units [0].GetSector();

        //Tests that a normal move was made.
        Assert.IsFalse(cardDeck.GetActiveCards().Contains(testCard1), "The AI's NothingCard was activated");
        Assert.IsFalse(cardDeck.GetActiveCards().Contains(testCard2), "The AI's FreshersFluCard was activated");
        Assert.AreEqual(2, numberOfOwnedSectors, "The computer player did not capture another sector");
        Assert.AreNotSame(unitsInitialSector, unitsNewSector, "The unit did not move sectors");
        Assert.Contains(unitsNewSector, unitsInitialSector.GetAdjacentSectors(), "The unit did not move into an adjacent sector");

        yield return(null);
    }
Пример #17
0
    public IEnumerator DeactivatePunishmentCards_OtherPlayerHasActiveCardNoneToDeactivate()
    {
        //Tests that if deactivatedPunishmentCards is called for a player with no active cards, another player's active card will not be deactivated.
        Setup();
        //Give player1 a punishment cards
        Player player1    = players [0];
        Card   activeCard = new FreshersFluCard(player1);

        player1.AddPunishmentCard(activeCard);

        //Activate card
        cardDeck.GetActiveCards().Add(activeCard);
        activeCard.SetTurnCount(1);

        Player player2 = players [1];

        cardDeck.DeactivatePunishmentCards(player2);          //Call DeactivatePunishmentCards for player2.

        //Test that activeCard is still active.
        Assert.Contains(activeCard, cardDeck.GetActiveCards());
        Assert.AreEqual(1, activeCard.GetTurnCount());
        Assert.AreSame(player1, activeCard.GetOwner());
        yield return(null);
    }
Пример #18
0
    public void Save()
    {
        Debug.Log("Entered Save Function");
        //Delete previous save data if exists
        if (File.Exists(Application.persistentDataPath + "/gameInformation.dat"))
        {
            File.Delete(Application.persistentDataPath + "/gameInformation.dat");
        }

        using (StreamWriter writer = new StreamWriter(Application.persistentDataPath + "/gameInformation.dat", true))
        {
            Debug.Log(Application.persistentDataPath);

            //write game state
            writer.WriteLine("Current Player:" + game.currentPlayer.name);
            writer.WriteLine("Turn state:" + game.GetTurnState());

            //write player info
            foreach (Player player in game.players)
            {
                writer.WriteLine(player.name + "Beer:" + player.GetBeer());
                writer.WriteLine(player.name + "Knowledge:" + player.GetKnowledge());
                writer.WriteLine(player.name + "IsHuman:" + player.IsHuman());
                writer.WriteLine(player.name + "IsActive:" + player.IsActive());

                // ASSESSMENT 4 ADDITION (22/03/2018)
                writer.Write(player.name + "PunishmentCards:");

                List <Card> cards = player.GetPunishmentCards();

                for (int i = 0; i < cards.Count; i++)
                {
                    writer.Write(cards[i].GetType().Name);

                    if (i + 1 != cards.Count)
                    {
                        writer.Write(",");
                    }
                }

                writer.WriteLine();
                //------------------------------------
            }

            // write sector info
            Sector[] sectors = map.GetComponentsInChildren <Sector>();

            foreach (Sector sector in sectors)
            {
                //write sector name and owner name
                writer.WriteLine(sector.name + ":");
                if (sector.GetOwner() == null)
                {
                    writer.WriteLine("owner:null");
                }
                else
                {
                    writer.WriteLine("owner:" + sector.GetOwner().name);
                }

                //write viceChance info
                if (sector.GetLandmark() == null)
                {
                    writer.WriteLine("viceChance:null");
                }
                else
                {
                    if (sector.GetLandmark().GetResourceType() == Landmark.ResourceType.ViceChancellor)
                    {
                        writer.WriteLine("viceChance:" + sector.GetLandmark().GetResourceType());
                    }
                    else
                    {
                        writer.WriteLine("viceChance:" + sector.GetLandmark().GetResourceType().ToString());
                    }
                }

                //write unit info
                if (sector.GetUnit() == null)
                {
                    writer.WriteLine("unit:null");
                }
                else
                {
                    //ASSESSMENT 4 ADDITION (22/03/2018)
                    Color  unitColor = sector.GetUnit().GetColor();
                    string ownerName = sector.GetUnit().GetOwner().name;
                    int    unitLevel = sector.GetUnit().GetLevel();

                    writer.WriteLine("unitOwner:" + ownerName + ":" + unitLevel + ":" + unitColor.r + ":" + unitColor.g + ":" + unitColor.b);
                    //----------------------------------
                }
            }

            // ASSESSMENT 4 ADDITION (22/03/2018)
            // Save active cards and their state
            List <Card> activeCards = game.cardDeck.GetActiveCards();
            writer.WriteLine("activeCards:" + activeCards.Count);

            foreach (Card activeCard in activeCards)
            {
                writer.WriteLine(activeCard.GetType().Name + ":" + activeCard.GetOwner().name + ":" + activeCard.GetTurnCount());

                switch (activeCard.GetType().Name)
                {
                case "FreshersFluCard":
                    FreshersFluCard            card             = (FreshersFluCard)activeCard;
                    Dictionary <Player, int[]> playerPvcBonuses = card.GetPvcBonuses();

                    foreach (KeyValuePair <Player, int[]> entry in playerPvcBonuses)
                    {
                        writer.WriteLine(entry.Key.name + ":" + entry.Value[0] + ":" + entry.Value[1]);
                    }

                    break;
                }
            }
            //------------------------------------
        }

        Debug.Log("Saved!");
    }
Пример #19
0
    public void Load()
    {
        Debug.Log("Entered Load");

        using (StreamReader reader = new StreamReader(Application.persistentDataPath + "/gameInformation.dat"))
        {
            string[] line = reader.ReadLine().Split(':');

            //restore current player
            if (line[0] == "Current Player")
            {
                DeactiveCurrentPlayer();
                //load in player saved
                game.currentPlayer = GameObject.Find(line[1]).GetComponent <Player>();
                game.currentPlayer.SetActive(true);
                game.currentPlayer.GetGui().Activate();
            }

            //restore move state
            line = reader.ReadLine().Split(':');

            if (line[0] == "Turn state")
            {
                switch (line[1])
                {
                case "Move1":
                    game.SetTurnState(Game.TurnState.Move1);
                    break;

                case "Move2":
                    game.SetTurnState(Game.TurnState.Move2);
                    break;

                case "EndOfTurn":
                    game.SetTurnState(Game.TurnState.EndOfTurn);
                    break;

                case "NULL":
                    game.SetTurnState(Game.TurnState.NULL);
                    break;
                }
            }

            // ASSESSMENT 4 ADDITION (22/03/2018)
            // restore players
            for (int i = 0; i < 4; i++)
            {
                game.players[i].SetBeer(int.Parse(reader.ReadLine().Split(':')[1].ToString()));
                game.players[i].SetKnowledge(int.Parse(reader.ReadLine().Split(':')[1].ToString()));
                game.players[i].SetHuman(bool.Parse(reader.ReadLine().Split(':')[1]));
                game.players[i].SetActive(bool.Parse(reader.ReadLine().Split(':')[1]));

                string[] cards = reader.ReadLine().Split(':')[1].Split(',');

                foreach (string card in cards)
                {
                    switch (card)
                    {
                    case "FreshersFluCard":
                        Card freshersFluCard = new FreshersFluCard(game.players[i]);
                        game.players[i].AddPunishmentCard(freshersFluCard);
                        break;

                    case "LecturerStrikeCard":
                        Card lecturerStrikeCard = new LecturerStrikeCard(game.players[i]);
                        game.players[i].AddPunishmentCard(lecturerStrikeCard);
                        break;

                    case "KillerHangoverCard":
                        Card killerHangoverCard = new KillerHangoverCard(game.players[i]);
                        game.players[i].AddPunishmentCard(killerHangoverCard);
                        break;

                    case "NothingCard":
                        Card nothingCard = new NothingCard(game.players[i]);
                        game.players[i].AddPunishmentCard(nothingCard);
                        break;
                    }
                }
            }
            //-----------------------------------

            //sectors
            Sector[] sectors = map.GetComponentsInChildren <Sector>();

            for (int i = 0; i < 32; i++)
            {
                reader.ReadLine().Split(':');

                //set sector owner
                line = reader.ReadLine().Split(':');

                string playerName = line[1];
                int    playerID   = GetPlayerIDByName(playerName);

                if (playerID != -1)
                {
                    sectors[i].SetOwner(game.players[playerID]);
                    game.players[playerID].ownedSectors.Add(sectors[i]);
                }
                else
                {
                    sectors[i].SetOwner(null);
                }

                //capture landmarks (and place vice chancellor if present)
                line = reader.ReadLine().Split(':');

                if (line[1] == "ViceChancellor")
                {
                    game.spawnVice(i);
                }
                else if (line[1] != "null")
                {
                    game.players[playerID].Capture(sectors[i]);
                }

                //spawn units (if present)
                //line = reader.ReadLine().Split();
                string aay = reader.ReadLine();
                line = aay.Split(':');

                if (line[1] != "null") //if there is a unit to place
                {
                    GameObject[] playerPrefabs = new GameObject[] {
                        player1UnitPrefab, player2UnitPrefab, player3UnitPrefab, player4UnitPrefab
                    };

                    // instantiate a new unit at the sector
                    Unit newUnit = Instantiate(playerPrefabs[playerID]).GetComponent <Unit>();

                    // initialize the new unit
                    newUnit.Initialize(game.players[playerID], sectors[i]);

                    // add the new unit to the player's list of units and
                    // the sector's unit parameters
                    game.players[playerID].units.Add(newUnit);
                    //sectors[i].SetUnit(newUnit);

                    newUnit.SetLevel(int.Parse(line[2]));

                    //ASSESSMENT 4 ADDITION (22/03/2018)
                    Color unitColor = new Color(
                        float.Parse(line[3]),
                        float.Parse(line[4]),
                        float.Parse(line[5])
                        );
                    newUnit.SetColor(unitColor);
                    newUnit.gameObject.GetComponent <Renderer>().material.color = unitColor;
                    //----------------------------------
                }
            }

            // ASSESSMENT 4 ADDITION (22/03/2018)
            // Reset active cards and their states
            line = reader.ReadLine().Split(':');

            if (line[0] == "activeCards")
            {
                for (int i = 0; i < int.Parse(line[1]); i++)
                {
                    string[] card      = reader.ReadLine().Split(':');
                    int      playerID  = GetPlayerIDByName(card[1]);
                    int      turnCount = int.Parse(card[2]);

                    switch (card[0])
                    {
                    case "FreshersFluCard":
                        FreshersFluCard freshersFluCard = new FreshersFluCard(game.players[playerID], turnCount);

                        Dictionary <Player, int[]> bonuses = new Dictionary <Player, int[]>();

                        for (int j = 0; j < 3; j++)
                        {
                            string[] playerLine = reader.ReadLine().Split(':');
                            playerID = GetPlayerIDByName(playerLine[0]);
                            bonuses.Add(game.players[playerID], new int[] {
                                int.Parse(playerLine[1]),
                                int.Parse(playerLine[2])
                            });
                        }

                        freshersFluCard.SetPvcBonuses(bonuses);
                        game.cardDeck.SetActiveCard(freshersFluCard);

                        break;

                    case "LecturerStrikeCard":
                        LecturerStrikeCard lecturerStrikeCard = new LecturerStrikeCard(game.players[playerID], turnCount);
                        game.cardDeck.SetActiveCard(lecturerStrikeCard);
                        GameObject strikeScene = GameObject.Instantiate(Resources.Load <GameObject> ("strike_model/StrikePeople"));
                        strikeScene.name = "StrikePeople";
                        break;

                    case "KillerHangoverCard":
                        KillerHangoverCard killerHangoverCard = new KillerHangoverCard(game.players[playerID], turnCount);
                        game.cardDeck.SetActiveCard(killerHangoverCard);
                        break;
                    }
                }
            }
        }

        Debug.Log("Loaded!");
    }