Пример #1
0
    protected override void PrepareForNewRoom(RoomCardModel newCard)
    {
        base.PrepareForNewRoom(newCard);

        roomTotalEnemies = Dungeon.Singleton.CurrentRoom.StartingEnemyCount;
        slainEnemies     = 0;
        actionValue      = 0;
    }
Пример #2
0
    // Prepare the agent values for a new room.
    // Happens either in awake or when the agent has entered a door to a new room.
    protected virtual void PrepareForNewRoom(RoomCardModel newCard)
    {
        currentCard        = newCard;
        currentCard.RoomID = Dungeon.Singleton.CurrentRoom.RoomID;

        minInteractionsToGetKeys = Dungeon.Singleton.CurrentRoom.requiredKeys.Count;
        HpEnteringRoom           = GetComponent <Player>().Health;
    }
Пример #3
0
    protected override void PrepareForNewRoom(RoomCardModel newCard)
    {
        base.PrepareForNewRoom(newCard);

        forcedCombat = 1;
        hpChange     = 1;
        forcedLoot   = 1;
    }
    protected override void PrepareForNewRoom(RoomCardModel newCard)
    {
        base.PrepareForNewRoom(newCard);

        roomTotalTreasures = Dungeon.Singleton.CurrentRoom.StartingTreasureCount;
        forcedCombat       = 1;
        lootedTreasures    = 0;
        lootValue          = 0;
    }
Пример #5
0
    public void SetCardValues(RoomCardModel card)
    {
        HeaderText.text += " " + card.RoomID;

        BodyText.text = "";
        foreach (var keyval in card.OutputValuePairs)
        {
            string value = keyval.Value.ToString();
            if (keyval.Value is float)
            {
                if (value.Length > 4)
                {
                    value = value.Substring(0, 4);
                }
            }
            BodyText.text += keyval.Key + ": " + value + "\n";
        }
    }
Пример #6
0
    public static void RegisterCard(RoomCardModel card)
    {
        var iteration = GameController.GameCurrentIteration;

        if (CardsPerRoom.ContainsKey(card.RoomID))
        {
            CardsPerRoom[card.RoomID].Add(card);
        }
        else
        {
            CardsPerRoom[card.RoomID] = new List <RoomCardModel>
            {
                card
            };
        }

        Cards.Add(card);
    }
Пример #7
0
 protected override void PrepareForNewRoom(RoomCardModel newCard)
 {
     base.PrepareForNewRoom(newCard);
 }
Пример #8
0
    public static List <RoomCardModel> GetSumarizedRoomCards()
    {
        List <RoomCardModel> summaryList = new List <RoomCardModel>();

        foreach (var key in CardsPerRoom.Keys)
        {
            var summarizedRoomCardModel = new RoomCardModel
            {
                RoomID = key
            };

            float summarizedRoomRating = 0;
            float lowestRating         = float.MaxValue;
            float highestRating        = float.MinValue;
            int   completeCount        = 0;

            foreach (RoomCardModel card in CardsPerRoom[key])
            {
                if ((string)card.OutputValuePairs["RoomStatus"] == "Completed")
                {
                    var roomRating = (float)card.OutputValuePairs["Opinion"];
                    if (roomRating < lowestRating)
                    {
                        lowestRating = roomRating;
                    }
                    if (roomRating > highestRating)
                    {
                        highestRating = roomRating;
                    }
                    summarizedRoomRating += roomRating;
                    completeCount++;
                }
            }

            var avgRating = summarizedRoomRating / completeCount;
            summarizedRoomCardModel.WriteTo("Avg rating", avgRating);
            //Median om det har körts fler än 5 iterationer.
            if (completeCount > 5)
            {
                var medianRating = 0.0;

                if (completeCount % 2 == 0)
                {
                    medianRating =
                        ((float)CardsPerRoom[key][completeCount / 2].OutputValuePairs["Opinion"] +
                         (float)CardsPerRoom[key][(completeCount / 2) + 1].OutputValuePairs["Opinion"]) / 2;
                }
                else
                {
                    medianRating = (float)CardsPerRoom[key][completeCount / 2].OutputValuePairs["Opinion"];
                }

                summarizedRoomCardModel.WriteTo("Median rating", medianRating);
            }

            summarizedRoomCardModel.WriteTo("Low", lowestRating);
            summarizedRoomCardModel.WriteTo("High", highestRating);

            summarizedRoomCardModel.WriteTo("Completion rate: ", completeCount + "/" + CardsPerRoom[key].Count);

            summaryList.Add(summarizedRoomCardModel);
        }

        return(summaryList);
    }