Ejemplo n.º 1
0
    private void UpdateSelectedHouse()
    {
        Room           currentRoom = housingController.GetCurrentRoom();
        StatsContainer stats       = playerData.stats[currentRoom.residentIndex];

        roomNumber.text     = housingController.GetRoomName();
        characterName.text  = (stats != null) ? stats.charData.entryName : "";
        characterClass.text = (stats != null) ? stats.currentClass.entryName : "";
        characterLevel.text = (stats != null) ? "Level  " + stats.level : "";
        portrait.sprite     = (stats != null) ? stats.charData.portraitSet.poses[0] : null;

        List <Room> neighbours = currentRoom.house.GetNeighbours(currentRoom);
        string      nr1 = "", nr2 = "";

        if (stats != null)
        {
            if (neighbours.Count > 0)
            {
                StatsContainer   neigh1      = playerData.stats[neighbours[0].residentIndex];
                SupportContainer supportCon1 = playerData.baseInfo[neighbours[0].residentIndex];
                nr1 += neigh1.charData.entryName;
                SupportTuple support = neigh1.charData.GetSupport(stats.charData);
                if (support != null)
                {
                    int supportValue = supportCon1.GetSupportValue(neigh1.charData).value;
                    nr1 += "\nRank " + support.CalculateLevel(supportValue) + "  " + support.GetSpeedString();
                }
                else
                {
                    nr1 += "\nRank -  (x)";
                }
            }
            else
            {
                nr1 = "-Empty-";
            }

            if (neighbours.Count > 1)
            {
                StatsContainer   neigh2      = playerData.stats[neighbours[1].residentIndex];
                SupportContainer supportCon2 = playerData.baseInfo[neighbours[1].residentIndex];
                nr2 += neigh2.charData.entryName;
                SupportTuple support = neigh2.charData.GetSupport(stats.charData);
                if (support != null)
                {
                    int supportValue = supportCon2.GetSupportValue(neigh2.charData).value;
                    nr2 += "\nRank " + support.CalculateLevel(supportValue) + "  " + support.GetSpeedString();
                }
                else
                {
                    nr2 += "\nRank -  (x)";
                }
            }
            else
            {
                nr2 = "-Empty-";
            }
        }

        neighbourStats1.text = nr1;
        neighbourStats2.text = nr2;
    }