public void SetPlayer(PlayerController player, bool isHouseOwner, TownHouseController dialogHouse)
    {
        this.player = player;
        var existingBonus = 0;

        lblHouseOwner.SetActive(isHouseOwner);

        if (dialogHouse.Owner)
        {
            var existingSkill = GameMath.GetSkillByHouseType(player.Stats, dialogHouse.TownHouse.Type);
            existingBonus = (int)GameMath.CalculateHouseExpBonus(existingSkill);
        }

        var skill       = GameMath.GetSkillByHouseType(player.Stats, dialogHouse.TownHouse.Type);
        var playerBonus = (int)GameMath.CalculateHouseExpBonus(skill);
        var bonusPlus   = playerBonus - existingBonus;

        lblPlayerName.text = player.Name;
        lblSkill.text      = skill.Name + " Lv. " + skill.CurrentValue;

        if (bonusPlus == 0)
        {
            lblBonus.text = $"<color=#FFFFFF>{playerBonus}% (+0%)";
            return;
        }

        if (bonusPlus > 0)
        {
            lblBonus.text = $"<color=#FFFFFF>{playerBonus}% <color=#0BFF00>(+{bonusPlus}%)";
        }
        else
        {
            lblBonus.text = $"<color=#FF0B00>{playerBonus}% (-{bonusPlus}%)";
        }
    }
Esempio n. 2
0
    public void SetOwner(PlayerController player)
    {
        Owner       = player;
        OwnerUserId = player?.UserId;

        if (!player || player == null)
        {
            gameManager?.Village?.SetBonus(Slot, SlotType, 0);
            return;
        }
        var existingSkill = GameMath.GetSkillByHouseType(player.Stats, SlotType);
        var bonus         = GameMath.CalculateHouseExpBonus(existingSkill);

        gameManager?.Village?.SetBonus(Slot, SlotType, bonus);
    }