Exemplo n.º 1
0
        //This should be virtual.  This way, if there are magical
        //armour with special when equipped functions, they can
        //overried GetInstance, and create a new instance of
        //the subtype/magical armour from it...
        public override SerializedObject GetInstance()
        {
            GenericArmour ret = new GenericArmour();

            InventoryItem.DressInstance(ret, inventoryItemWrapper as InventoryItemWrapper);
            GenericArmour.DressInstance(ret, this);
            return(ret);
        }
Exemplo n.º 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);
            }
Exemplo n.º 3
0
        public Wrapper GetSerializableWrapper()
        {
            PaperDollWrapper wrap = new PaperDollWrapper();

            wrap.equipment      = new Wrapper[slots.Count];
            wrap.slots          = new EquipmentSlotType[slots.Count];
            wrap.equipmentTypes = new EquipmentType[slots.Count];

            List <EquipmentSlotType> types = new List <EquipmentSlotType> ();

            int i = 0;

            foreach (EquipmentSlotType s in slots.Keys)
            {
                wrap.slots [i] = s;
                Equipment equipped = slots [s];

                if (equipped is GenericArmour)
                {
                    GenericArmour arm = (GenericArmour)equipped;
                    wrap.equipment [i] = arm.GetSerializableWrapper();
                }
                else if (equipped is GenericWeapon)
                {
                    GenericWeapon weap = (GenericWeapon)equipped;
                    wrap.equipment [i] = weap.GetSerializableWrapper();
                }
                else
                {
                    Debug.LogError("Not yet supporting serialization for " + equipped.GetType());
                }

                wrap.equipmentTypes [i] = equipped.Type;
                i++;
            }

            return(wrap);
        }
Exemplo n.º 4
0
        public KnightKit() : base()
        {
            //add stuff to apply
            ups.Add((Sheet c) => {
                Longsword sword = new Longsword();
                c.PaperDoll.Equip(EquipmentSlotType.MAIN_HAND, sword, c);
            });

            downs.Add((Sheet c) => {
                c.PaperDoll.Unequip(EquipmentSlotType.MAIN_HAND, c);
                //c.PaperDoll.Unquip(EquipmentSlotType.MAIN_HAND, sword, c);
            });

            //add stuff to apply
            ups.Add((Sheet c) => {
                GenericArmour chain = new GenericArmour(EquipmentSubtype.ARMOUR_CHAINMAIL);
                c.PaperDoll.Equip(EquipmentSlotType.BODY, chain, c);
            });

            downs.Add((Sheet c) => {
                c.PaperDoll.Unequip(EquipmentSlotType.BODY, c);
                //c.PaperDoll.Unquip(EquipmentSlotType.MAIN_HAND, sword, c);
            });



            ups.Add((Sheet c) => {
                GenericShield shield = new GenericShield();
                c.PaperDoll.Equip(EquipmentSlotType.OFF_HAND, shield, c);
            });

            downs.Add((Sheet c) => {
                c.PaperDoll.Unequip(EquipmentSlotType.OFF_HAND, c);
                //c.PaperDoll.Unquip(EquipmentSlotType.MAIN_HAND, sword, c);
            });
        }
Exemplo n.º 5
0
 public static void DressInstance(GenericArmour armour, GenericArmourWrapper wrap)
 {
     SetArmourProperties(armour, wrap.subtype);
 }
Exemplo n.º 6
0
        /// <summary>
        /// Armour property table.  Sets the basic properties for the armour subtypes.
        /// To see how enchantments are stored and set, see the Set equipment enchantment types.
        /// </summary>
        /// <param name="weapon">Weapon.</param>
        /// <param name="t">T.</param>
        public static void SetArmourProperties(GenericArmour armour, EquipmentSubtype t)
        {
            armour.Subtype = t;
            switch (t)
            {
            case EquipmentSubtype.ARMOUR_PADDED:
                armour.Type   = EquipmentType.ARMOUR_LIGHT;
                armour.BaseAc = 11;
                armour.MaxDexterityACModifier = 30;                 //no max
                armour.onEquippedEffects.Add(ApplyStealthDisArmourEquipped);
                armour.onUnequippedEffects.Add(ApplyStealthDisArmourUnequipped);
                armour.FittingSlotTypes = new List <EquipmentSlotType> ()
                {
                    EquipmentSlotType.BODY
                };
                break;

            case EquipmentSubtype.ARMOUR_LEATHER:
                armour.Type   = EquipmentType.ARMOUR_LIGHT;
                armour.BaseAc = 12;
                armour.MaxDexterityACModifier = 30;                 //no max
                armour.IconType = IconName.LEATHER_ARMOUR;
                armour.AnimationControllerName = EquipmentAnimationControllerName.BODY_LEATHERARMOUR;
                armour.FittingSlotTypes        = new List <EquipmentSlotType> ()
                {
                    EquipmentSlotType.BODY
                };
                break;

            case EquipmentSubtype.ARMOUR_CHAINMAIL:
                armour.Type   = EquipmentType.ARMOUR_MEDIUM;
                armour.BaseAc = 13;
                armour.MaxDexterityACModifier  = 2;                //medium max
                armour.AnimationControllerName = EquipmentAnimationControllerName.BODY_CHAINARMOUR;
                armour.StrengthRecommendation  = 13;
                armour.IconType         = IconName.CHAIN_MAIL;
                armour.FittingSlotTypes = new List <EquipmentSlotType> ()
                {
                    EquipmentSlotType.BODY
                };
                break;

            case EquipmentSubtype.ARMOUR_METAL_SHIELD:
                armour.Type = EquipmentType.ARMOUR_SHIELD;
                armour.onEquippedEffects.Add(ShieldEquipped);
                armour.onUnequippedEffects.Add(ShieldUnequipped);
                armour.AnimationControllerName = EquipmentAnimationControllerName.METAL_SHIELD;
                armour.IconType         = IconName.SHIELD_METAL;
                armour.FittingSlotTypes = new List <EquipmentSlotType> ()
                {
                    EquipmentSlotType.OFF_HAND
                };
                break;

            case EquipmentSubtype.ARMOUR_HORNED_HELM:
                armour.Type = EquipmentType.ARMOUR_LIGHT;                 //horned helm is not really light armour.... in fact it's not really armour
                armour.AnimationControllerName = EquipmentAnimationControllerName.HEAD_HORNEDHELMET;
                armour.IconType         = IconName.HORNED_HELM;
                armour.FittingSlotTypes = new List <EquipmentSlotType> ()
                {
                    EquipmentSlotType.HEAD
                };
                break;

            default:
                Debug.LogError("issue. type was not valid: " + t);
                break;
            }
        }