示例#1
0
    /// <summary>
    /// ボーナスする能力値を決めます
    /// </summary>
    /// <param name="player">ボーナスを適用するキャラクター</param>
    public void activate(IPlayable player)
    {
        //各パラメータを取得、初期化
        var battleAbilities   = player.getBattleAbilities();
        var friendlyAbilities = player.getFriendlyAbilities();
        Dictionary <Object, int> abilities = new Dictionary <Object, int>();

        var bKeys = battleAbilities.Keys;

        foreach (BattleAbility ablity in bKeys)
        {
            abilities.Add(ablity, battleAbilities[ablity]);
        }

        var fKeys = friendlyAbilities.Keys;

        foreach (FriendlyAbility ability in fKeys)
        {
            abilities.Add(ability, friendlyAbilities[ability]);
        }

        //各パラメータをintのパラメータ値でソート
        int[] abilityValues = new int[7];
        abilities.Values.CopyTo(abilityValues, 0);

        Object[] abilityKeys = new Object[7];
        abilities.Keys.CopyTo(abilityKeys, 0);

        deployAbilities();
        orderAbilities(abilityKeys, abilityValues);
        shuffleAbilities(abilityKeys);
    }
        /// <summary>
        /// キャラクターのパラメータを表示せます
        /// </summary>
        /// <param name="character">表示させたいキャラクター</param>
        public void setCharacter(IPlayable character)
        {
            nameText.text = character.getName();

            parameterView.setAbilities(character.getLevel(), character.getBattleAbilities(), character.getFriendlyAbilities());

            var weapon = character.getWeapon();

            weaponText.text = (weapon != null) ?  "E:" + weapon.getName() : "武器非装備";
            var armor = character.getArmor();

            armorText.text = (armor != null) ? "E:" + armor.getName() : "防具非装備";

            hpBar.fillAmount = (float)character.getHp() / (float)character.getMaxHp();
            mpBar.fillAmount = (float)character.getMp() / (float)character.getMaxMp();
            hpValue.text     = character.getHp() + "/" + character.getMaxHp();
            mpValue.text     = character.getMp() + "/" + character.getMaxMp();

            metalText.text += (character is Player) ? ((Player)character).getMetal() + "mt" : "なし";
        }