コード例 #1
0
 /// <summary>
 /// 防具の文字を設定(抜粋)
 /// </summary>
 /// <param name="text">設定する文字</param>
 /// <param name="armor">防具</param>
 /// <param name="type">部位</param>
 private void SetProtectionText(ref string text, ProtectionItem[] armor, ProtectionItem.ProtectionType type)
 {
     if (armor[(int)type] == null)
     {
         EquipNull(ref text);
     }
     else
     {
         colors[(int)type] = Color.Lerp(Color.White, Color.Gold, armor[(int)type].GetItemRare() / 8.0f);
         text = armor[(int)type].GetItemName() + " + " + armor[(int)type].GetReinforcement();
     }
 }
コード例 #2
0
        /// <summary>
        /// バッグ内のアイテムを装備する
        /// </summary>
        /// <param name="bagIndex">バッグ内のIndex</param>
        public void EquipArmor(int bagIndex)
        {
            Item item = bag[bagIndex];

            if (!(item is ProtectionItem))
            {
                return;
            }

            ProtectionItem.ProtectionType type = ((ProtectionItem)item).GetProtectionType();
            int typeIndex = type - ProtectionItem.ProtectionType.Helm;

            if (armor[typeIndex] != null)                 //装備している状態
            {
                bag.Add(armor[typeIndex]);                //バッグに戻す
            }
            armor[typeIndex] = (ProtectionItem)item;      //装備する
            bag.RemoveAt(bagIndex);
        }