示例#1
0
        public override Wrapper GetSerializableWrapper()
        {
            GenericWeaponWrapper w = new GenericWeaponWrapper();

            w.subtype = this.Subtype;

            w.inventoryItemWrapper = base.GetSerializableWrapper();

            return(w);
        }
示例#2
0
            public override SerializedObject GetInstance()
            {
                PaperDoll ret = new PaperDoll();

                List <EquipmentType> armours = new List <EquipmentType> ()
                {
                    EquipmentType.ARMOUR_HEAVY,
                    EquipmentType.ARMOUR_LIGHT,
                    EquipmentType.ARMOUR_MEDIUM,
                    EquipmentType.ARMOUR_SHIELD
                };

                List <EquipmentType> weapons = new List <EquipmentType> ()
                {
                    EquipmentType.WEAPON_SIMPLE,
                    EquipmentType.WEAPON_MARTIAL,
                    EquipmentType.WEAPON_UNARMED
                };

//				List<EquipmentType> shields = new List<EquipmentType> () {
//					EquipmentType.ARMOUR_SHIELD
//				};

                for (int i = 0; i < equipment.Length; i++)
                {
                    //notice the equipment doesn't get equipped, which means
                    //the parent sheet will need to worry about that for itself.
                    if (armours.Contains(equipmentTypes [i]))
                    {
                        GenericArmourWrapper wrap = (GenericArmourWrapper)equipment [i];
                        GenericArmour        e    = (GenericArmour)wrap.GetInstance();
                        ret.slots.Add(slots [i], e);
                    }
                    else if (weapons.Contains(equipmentTypes [i]))
                    {
                        GenericWeaponWrapper wrap = (GenericWeaponWrapper)equipment [i];
                        GenericWeapon        e    = (GenericWeapon)wrap.GetInstance();
                        ret.slots.Add(slots [i], e);
                    }
                    //this should not be nessecary....
//					else if (shields.Contains(equipmentTypes [i])) {
//						//throw new UnityException ("No generic subclass for shield yet.  Cannot support deserialization");
//						GenericShield e = (GenericShield)equipment [i].GetInstance ();
//						ret.slots.Add (slots [i], e);
//					}
                    else
                    {
                        throw new UnityException("There is no case for deserializing this equipment type: " + equipmentTypes [i]);
                    }

//					Equipment e = (Equipment) equipment [i].GetInstance ();
                }

                return(ret);
            }
示例#3
0
 public static void DressInstance(GenericWeapon weapon, GenericWeaponWrapper wrap)
 {
     GenericWeapon.SetWeaponProperties(weapon, wrap.subtype);
 }