public Living(SerializationInfo info, StreamingContext context) : base(info, context) { //animations idleAnimation = info.GetString("idleAnimation"); moveAnimation = info.GetString("moveAnimation"); dieAnimation = info.GetString("dieAnimation"); dieSound = info.GetString("dieSound"); inventory = info.TryGUIDThenFull <InventoryBox>(context, "inventory"); equipmentSlots = info.TryGUIDThenFull <GameObjectList>(context, "equipmentSlots"); skillList = info.TryGUIDThenFull <GameObjectList>(context, "skillList"); currentSkill = info.TryGUIDThenFull <Skill>(context, "currentSkill"); //stats manaPoints = info.GetInt32("manaPoints"); healthPoints = info.GetInt32("healthPoints"); actionPoints = info.GetInt32("actionPoints"); baseAttack = info.GetInt32("baseAttack"); strength = info.GetInt32("strength"); dexterity = info.GetInt32("dexterity"); intelligence = info.GetInt32("intelligence"); wisdom = info.GetInt32("wisdom"); luck = info.GetInt32("luck"); vitality = info.GetInt32("vitality"); creatureLevel = info.GetInt32("creatureLevel"); baseReach = info.GetInt32("baseReach"); specialReach = info.GetInt32("specialReach"); viewDistance = info.GetInt32("viewDistance"); }
public Container(SerializationInfo info, StreamingContext context) : base(info, context) { iBox = info.TryGUIDThenFull <InventoryBox>(context, "iBox"); Closed = info.GetBoolean("Closed"); floorNumber = info.GetInt32("floorNumber"); openContainerSprite = info.GetString("openContainerSprite"); openSound = info.GetString("openSound"); }
public Container(string asset, string openContainerSprite, string openSound, int floorNumber, InventoryBox inv = null, int layer = 0, string id = "") : base(asset, layer, id) { iBox = inv ?? new InventoryBox(2, 4, layer + 1, "", cameraSensitivity); this.floorNumber = floorNumber; Closed = true; this.openContainerSprite = openContainerSprite; this.openSound = openSound; }
public override void Replace(GameObject replacement) { if (iBox != null && iBox.GUID == replacement.GUID) { iBox = replacement as InventoryBox; } base.Replace(replacement); }
//I suggest using an inventory background sprite and using its height and width in the base public PlayerInventoryAndEquipment(InventoryBox inventory, GameObjectList equipmentslots) : base(576, 384)//base(inventory.ItemGrid.Columns * Tile.TileHeight, (2 + inventory.ItemGrid.Rows) * Tile.TileHeight) { //inventory.Position = new Vector2(0, 2 * inventory.ItemGrid.CellHeight); inventory.Position = new Vector2(inventory.CellHeight, inventory.CellWidth); Add(inventory); Add(equipmentslots); SetEquipmentPositions(); SpriteGameObject background = new SpriteGameObject("inventory/background", -1, cameraSensitivity: 0); SpriteGameObject boxes = new SpriteGameObject("inventory/boxes", cameraSensitivity: 0); Add(background); Add(boxes); //this is not ideal but works for now }
/// <summary> /// Create a new Living object /// </summary> /// <param name="layer">The layer for drawing the object</param> /// <param name="id">The (unique) object ID</param> /// <param name="FOVlength">The view distance for the object</param> /// <param name="scale">The scale (multiplier) for the sprite size</param> public Living(int layer = 0, string id = "", float FOVlength = 8.5f, float scale = 1.0f) : base(layer, id, scale) { SetStats(); viewDistance = FOVlength; skillList = new GameObjectList(); for (int x = 0; x < 10; x++) { skillList.Add(new RestrictedItemSlot(typeof(Skill), "inventory/slot", id: "skillSlot" + x)); } inventory = new InventoryBox(4, 4, 0, ""); equipmentSlots = new GameObjectList(); equipmentSlots.Add(new RestrictedItemSlot(typeof(WeaponEquipment), "inventory/weaponSlot", id: "weaponSlot")); equipmentSlots.Add(new RestrictedItemSlot(typeof(BodyEquipment), "inventory/bodySlot", id: "bodySlot")); equipmentSlots.Add(new RestrictedItemSlot(typeof(RingEquipment), "inventory/ringSlot", id: "ringSlot1")); equipmentSlots.Add(new RestrictedItemSlot(typeof(RingEquipment), "inventory/ringSlot", id: "ringSlot2")); equipmentSlots.Add(new RestrictedItemSlot(typeof(HeadEquipment), "inventory/headSlot", id: "headSlot")); InitAnimationVariables(); LoadAnimations(); PlayAnimation("idle"); }