public Lifeboat(Lifeboat getLifeboat) { ItemName = getLifeboat.ItemName; Sector = getLifeboat.Sector; Location = getLifeboat.Location; ItemImage = getLifeboat.ItemImage; AvailableBackpacks = getLifeboat.AvailableBackpacks; AvailableEmptyContainers = getLifeboat.AvailableEmptyContainers; AvailableFirstAidKits = getLifeboat.AvailableFirstAidKits; AvailableFlareGuns = getLifeboat.AvailableFlareGuns; AvailableGranolaBars = getLifeboat.AvailableGranolaBars; AvailableKnives = getLifeboat.AvailableKnives; AvailableMatchboxes = getLifeboat.AvailableMatchboxes; AvailableString = getLifeboat.AvailableString; AvailableTents = getLifeboat.AvailableTents; }
public void ClickEvent (Point clickLocation, MouseButtons buttonClicked) { ItemDetailsPanel.Size = new Size(189, 285); #region Left Mouse Click if (buttonClicked == MouseButtons.Left) { lastClickWasLeftBtn = true; if (Math.Sqrt(Math.Pow(clickLocation.X - (player.RealPosition.X + 10), 2) + Math.Pow(clickLocation.Y - (player.RealPosition.Y + 13), 2)) < 40) { bool shouldShowDetails = false; if (new RectangleF(clickLocation, new SizeF(1, 1)).IntersectsWith(new RectangleF(player.RealPosition, new SizeF(20, 27)))) { string isWetString = ""; if (player.IsWet) isWetString = "Yes"; else isWetString = "No"; string isSickString = ""; if (player.IsSick) isSickString = "Yes"; else isSickString = "No"; string isAwakeString = ""; if (player.IsAwake) isAwakeString = "Yes"; else isAwakeString = "No"; ItemNameLabel.Text = player.Name; ItemDescriptionLabel.Text = "You. Alone on this island and having to survive." + "\n" + "Are You Awake: " + isAwakeString + "\n" + "Are You Wet: " + isWetString + "\n" + "Are You Sick: " + isSickString; ItemImage.Image = Image.FromFile("Images/Player Images/PlayerDownNeutral.png"); if (player.IsAwake) ActionButton1.Text = "Go to Sleep"; else ActionButton1.Text = "Wake Up"; ActionButton2.Text = ""; ActionButton2.Enabled = false; ItemDetailsPanel.Location = clickLocation; shouldShowDetails = true; } if (new Bitmap(this.BackgroundImage).GetPixel(clickLocation.X, clickLocation.Y).B > 200) { bool isSaltWater = true; if (!coastalSectors.Contains(player.Sector)) isSaltWater = false; if (player.Sector == 25) { if (clickLocation.Y <= 66) isSaltWater = false; } else if (player.Sector == 48) { if (clickLocation.X <= 200) isSaltWater = false; } else if (player.Sector == 62) { if (clickLocation.X <= 960) isSaltWater = false; } else if (player.Sector == 63) { if (clickLocation.Y <= 360) isSaltWater = false; } else if (player.Sector == 81) { if (clickLocation.X >= 920 && clickLocation.Y >= 200) isSaltWater = false; } else if (player.Sector == 117) { if (clickLocation.Y >= 780) isSaltWater = false; } else if (player.Sector == 140) { if (clickLocation.X <= 100 && clickLocation.Y <= 640) isSaltWater = false; } else if (player.Sector == 148) { if (clickLocation.X >= 700) isSaltWater = false; } else if (player.Sector == 159) { if (clickLocation.X >= 1000) isSaltWater = false; } else if (player.Sector == 183) { if (clickLocation.Y <= 500) isSaltWater = false; } else if (player.Sector == 194) { if (clickLocation.Y >= 300) isSaltWater = false; } if (isSaltWater) { ItemNameLabel.Text = "Salt Water"; ItemDescriptionLabel.Text = "Ocean water with a high amount of salt."; } else { ItemNameLabel.Text = "Fresh Water"; ItemDescriptionLabel.Text = "Clean, fresh running water."; } ItemImage.Image = Image.FromFile("Images/Other Images/Raindrop.png"); ActionButton1.Text = "Drink Water"; ActionButton2.Text = ""; ActionButton1.Enabled = true; ActionButton2.Enabled = false; ItemDetailsPanel.Location = clickLocation; shouldShowDetails = true; } foreach (var tree in trees) { if (tree.Sector == player.Sector && new RectangleF(clickLocation, new Size(1, 1)).IntersectsWith(new RectangleF(tree.Location, new Size(99, 89)))) { ItemNameLabel.Text = tree.ItemName; ItemDescriptionLabel.Text = "A tree with low hanging branches"; ItemImage.Image = tree.ItemImage; ActionButton1.Text = ""; ActionButton2.Text = ""; ActionButton1.Enabled = false; ActionButton2.Enabled = false; ItemDetailsPanel.Location = clickLocation; shouldShowDetails = true; } } foreach (var tent in availableTents) { if (tent.Sector == player.Sector && new RectangleF(clickLocation, new Size(1, 1)).IntersectsWith(new RectangleF(tent.Location, new Size(60, 60)))) { ItemNameLabel.Text = tent.ItemName; ItemDescriptionLabel.Text = "A high grade structure which will protect you from the elements" + "\n" + "Inventory Space: " + tent.InventorySpace; ItemImage.Image = tent.ItemImageImGame; if (!tent.IsOccupied) { ActionButton1.Text = "Pick Up"; ActionButton2.Text = "Enter Tent"; } else { ActionButton1.Text = "Leave Tent"; if (player.IsAwake) ActionButton2.Text = "Go to Sleep"; else ActionButton2.Text = "Wake Up"; } ItemDetailsPanel.Location = clickLocation; ActionButton1.Enabled = true; ActionButton2.Enabled = true; selectedTent = new Tent(tent); shouldShowDetails = true; } } foreach (var newBird in availableBirds) { if (newBird.Sector == player.Sector && new RectangleF(clickLocation, new Size(1, 1)).IntersectsWith(new RectangleF(newBird.Location, newBird.ItemImage.Size)) && !newBird.IsAlive) { ItemNameLabel.Text = newBird.ItemName; ItemDescriptionLabel.Text = "A bird that has been shot down that must be prepared before eating" + "\n" + "Inventory Space: " + newBird.InventorySpace + "\n" + "Is Prepared: " + newBird.IsPrepared + "\n" + "Is Cooked: " + newBird.IsCooked; ItemImage.Image = newBird.ItemImage; ActionButton1.Text = "Pick Up"; if (newBird.IsPrepared) ActionButton2.Text = "Eat Bird"; else { ActionButton2.Text = ""; ActionButton2.Enabled = false; } ItemDetailsPanel.Location = clickLocation; ActionButton1.Enabled = true; selectedBird = new Bird(newBird); shouldShowDetails = true; } } int shelterIndex = 0; foreach (var shelter in shelters) { if (shelter.Sector == player.Sector && new RectangleF(clickLocation, new Size(1, 1)).IntersectsWith(new RectangleF(shelter.Location, new Size(55, 45)))) { ItemNameLabel.Text = shelter.ItemName; ItemDescriptionLabel.Text = "An unsophisticated shelter which may protect you from the elements"; ItemImage.Image = shelter.ItemImage; if (!shelter.IsOccupied) ActionButton1.Text = "Enter Shelter"; else ActionButton1.Text = "Leave Shelter"; if (shelter.IsOccupied) { if (player.IsAwake) ActionButton2.Text = "Go To Sleep"; else ActionButton2.Text = "Wake Up"; ActionButton2.Enabled = true; } else { ActionButton2.Text = ""; ActionButton2.Enabled = false; } ItemDetailsPanel.Location = clickLocation; ActionButton1.Enabled = true; selectedShelterIndex = shelterIndex; shouldShowDetails = true; } shelterIndex++; } foreach (var newLifeboat in lifeboats) { if (newLifeboat.Sector == player.Sector && new RectangleF(clickLocation, new Size(1, 1)).IntersectsWith(new RectangleF(newLifeboat.Location, new Size(39, 62)))) { ItemNameLabel.Text = newLifeboat.ItemName; ItemDescriptionLabel.Text = "The lifeboat that you arrived in. It has been wrecked on the beach."; ItemImage.Image = newLifeboat.ItemImage; ActionButton1.Text = "Investigate"; ActionButton2.Text = ""; ActionButton2.Enabled = false; ItemDetailsPanel.Location = clickLocation; ActionButton1.Enabled = true; selectedLifeboat = new Lifeboat(newLifeboat); shouldShowDetails = true; } } foreach (var fire in fires) { if (fire.Sector == player.Sector && new RectangleF(clickLocation, new Size(1, 1)).IntersectsWith(new RectangleF(fire.Location, new Size(48, 48)))) { ItemNameLabel.Text = fire.ItemName; ItemDescriptionLabel.Text = "A basic source of heat and light" + "\n" + "Fuels: "; foreach (string fuel in fire.Fuels) ItemDescriptionLabel.Text += fuel + ", "; ItemDescriptionLabel.Text = ItemDescriptionLabel.Text.Remove(ItemDescriptionLabel.Text.Length - 2, 2); ItemDescriptionLabel.Text += "\n" + "Is Smoking: " + fire.IsSmoking + "\n" + "Has Burned: " + fire.HasBurned; if (fire.IsLit) ItemImage.Image = fire.LitImage; else ItemImage.Image = fire.UnlitImage; ActionButton1.Text = ""; ActionButton2.Text = ""; ActionButton1.Enabled = false; ActionButton2.Enabled = false; ItemDetailsPanel.Location = clickLocation; selectedFire = new Fire(fire); shouldShowDetails = true; } } foreach (var leafyBranch in availableLeafyBranches) { if (leafyBranch.Sector == player.Sector && new RectangleF(clickLocation, new Size(1, 1)).IntersectsWith(new RectangleF(leafyBranch.Location, new Size(48, 31)))) { ItemNameLabel.Text = leafyBranch.ItemName; ItemDescriptionLabel.Text = "A branch covered in green leaves" + "\n" + "Inventory Space: " + leafyBranch.InventorySpace; ItemImage.Image = leafyBranch.ItemImage; ActionButton1.Text = "Pick Up"; if (!leafyBranch.HasEatenLeaves) ActionButton2.Text = "Eat Leaves"; else { ActionButton2.Text = ""; ActionButton2.Enabled = false; } ItemDetailsPanel.Location = clickLocation; ActionButton1.Enabled = true; ActionButton2.Enabled = true; selectedLeafyBranch = new LeafyBranch(leafyBranch); shouldShowDetails = true; } } foreach (var largeRock in availableLargeRocks) { if (largeRock.Sector == player.Sector && new RectangleF(clickLocation, new Size(1, 1)).IntersectsWith(new RectangleF(largeRock.Location, new Size(45, 33)))) { ItemNameLabel.Text = largeRock.ItemName; ItemDescriptionLabel.Text = "A boulder that you can climb on top of" + "\n" + "Inventory Space: " + largeRock.InventorySpace; ItemImage.Image = largeRock.ItemImage; ActionButton1.Text = "Pick Up"; ActionButton2.Text = "Climb Rock"; ItemDetailsPanel.Location = clickLocation; ActionButton1.Enabled = true; ActionButton2.Enabled = true; selectedLargeRock = new LargeRock(largeRock); shouldShowDetails = true; } } foreach (var fishingRod in availableFishingRods) { if (fishingRod.Sector == player.Sector && new RectangleF(clickLocation, new Size(1, 1)).IntersectsWith(new RectangleF(fishingRod.Location, new Size(34, 38)))) { ItemNameLabel.Text = fishingRod.ItemName; ItemDescriptionLabel.Text = "A simple device that enables you to catch fish" + "\n" + "Inventory Space: " + fishingRod.InventorySpace; ItemImage.Image = fishingRod.ItemImage; ActionButton1.Text = "Pick Up"; ActionButton2.Text = ""; ActionButton2.Enabled = false; ItemDetailsPanel.Location = clickLocation; ActionButton1.Enabled = true; selectedFishingRod = new FishingRod(fishingRod); shouldShowDetails = true; } } foreach (var log in availableLogs) { if (log.Sector == player.Sector && new RectangleF(clickLocation, new Size(1, 1)).IntersectsWith(new RectangleF(log.Location, new Size(45, 28)))) { ItemNameLabel.Text = log.ItemName; ItemDescriptionLabel.Text = "A large, straight piece of wood" + "\n" + "Inventory Space: " + log.InventorySpace; ItemImage.Image = log.ItemImage; ActionButton1.Text = "Pick Up"; ActionButton2.Text = ""; ActionButton2.Enabled = false; ItemDetailsPanel.Location = clickLocation; ActionButton1.Enabled = true; selectedLog = new Log(log); shouldShowDetails = true; } } int raftIndex = 0; foreach (var raft in rafts) { if (raft.Sector == player.Sector && new RectangleF(clickLocation, new Size(1, 1)).IntersectsWith(new RectangleF(raft.Location, new Size(42, 30)))) { ItemNameLabel.Text = raft.ItemName; ItemDescriptionLabel.Text = "A wooded raft that can transport you on water at greater speed than walking"; ItemImage.Image = raft.ItemImage; if (!raft.IsBoarded) ActionButton1.Text = "Board Raft"; else ActionButton1.Text = "Leave Raft"; ActionButton2.Text = ""; ItemDetailsPanel.Location = clickLocation; ActionButton1.Enabled = true; ActionButton2.Enabled = true; selectedRaftIndex = raftIndex; shouldShowDetails = true; } raftIndex++; } foreach (var newFish in availableFish) { if (newFish.Sector == player.Sector && new RectangleF(clickLocation, new Size(1, 1)).IntersectsWith(new RectangleF(newFish.Location, new Size(47, 22)))) { ItemNameLabel.Text = newFish.ItemName; if (newFish.IsCooked) ItemDescriptionLabel.Text = "A whole raw fish that is edible" + "\n" + "Inventory Space: " + newFish.InventorySpace; else ItemDescriptionLabel.Text = "A whole cooked fish that is safe to eat" + "\n" + "Inventory Space: " + newFish.InventorySpace; ItemImage.Image = newFish.ItemImage; ActionButton1.Text = "Pick Up"; ActionButton2.Text = "Eat Fish"; ItemDetailsPanel.Location = clickLocation; ActionButton1.Enabled = true; ActionButton2.Enabled = true; selectedFish = new Fish(newFish); shouldShowDetails = true; } } foreach (var newBackpack in availableBackpacks) { if (newBackpack.Sector == player.Sector && new RectangleF(clickLocation, new Size(1, 1)).IntersectsWith(new RectangleF(newBackpack.Location, new Size(33, 30)))) { ItemNameLabel.Text = newBackpack.ItemName; ItemDescriptionLabel.Text = "This backpack enables you to carry more items" + "\n" + "Added Inventory Space: " + newBackpack.AddedInventory; ItemImage.Image = newBackpack.ItemImage; ActionButton1.Text = "Pick Up"; ActionButton2.Text = ""; ActionButton2.Enabled = false; ItemDetailsPanel.Location = clickLocation; selectedBackback = new Backpack(newBackpack); shouldShowDetails = true; } } foreach (var torch in availableTorches) { if (torch.Sector == player.Sector && new RectangleF(clickLocation, new Size(1, 1)).IntersectsWith(new RectangleF(torch.Location, new Size(30, 30)))) { ItemNameLabel.Text = torch.ItemName; ItemDescriptionLabel.Text = "When lit, grants you light and fire" + "\n" + "Inventory Space: " + torch.InventorySpace + "\n" + "Has Burned: " + torch.HasBurned.ToString(); ItemImage.Image = torch.ItemImage; ActionButton1.Text = "Pick Up"; ActionButton2.Text = ""; ActionButton2.Enabled = false; ItemDetailsPanel.Location = clickLocation; ActionButton1.Enabled = true; selectedTorch = new Torch(torch); shouldShowDetails = true; } } foreach (var knife in availableKnives) { if (knife.Sector == player.Sector && new RectangleF(clickLocation, new Size(1, 1)).IntersectsWith(new RectangleF(knife.Location, new Size(30, 29)))) { ItemNameLabel.Text = knife.ItemName; ItemDescriptionLabel.Text = "A survival knife that can be used multiple ways" + "\n" + "Inventory Space: " + knife.InventorySpace; ItemImage.Image = knife.ItemImage; ActionButton1.Text = "Pick Up"; ActionButton2.Text = "Commit Suicide"; ItemDetailsPanel.Location = clickLocation; ActionButton1.Enabled = true; ActionButton2.Enabled = true; selectedKnife = new Knife(knife); shouldShowDetails = true; } } foreach (var spear in availableSpears) { if (spear.Sector == player.Sector && new RectangleF(clickLocation, new Size(1, 1)).IntersectsWith(new RectangleF(spear.Location, new Size(22, 36)))) { ItemNameLabel.Text = spear.ItemName; ItemDescriptionLabel.Text = "A sharp stick that can pierce flesh" + "\n" + "Inventory Space: " + spear.InventorySpace; ItemImage.Image = spear.ItemImage; ActionButton1.Text = "Pick Up"; ActionButton2.Text = "Trow Spear"; ItemDetailsPanel.Location = clickLocation; ActionButton1.Enabled = true; ActionButton2.Enabled = true; selectedSpear = new Spear(spear); shouldShowDetails = true; } } foreach (var stick in availableSticks) { if (stick.Sector == player.Sector && new RectangleF(clickLocation, new Size(1, 1)).IntersectsWith(new RectangleF(stick.Location, new Size(30, 21)))) { ItemNameLabel.Text = stick.ItemName; ItemDescriptionLabel.Text = "A few sticks that look thin but sturdy" + "\n" + "Inventory Space: " + stick.InventorySpace; ItemImage.Image = stick.ItemImage; ActionButton1.Text = "Pick Up"; ActionButton2.Text = ""; ActionButton2.Enabled = false; ItemDetailsPanel.Location = clickLocation; ActionButton1.Enabled = true; selectedSticks = new Sticks(stick); shouldShowDetails = true; } } foreach (var flareGun in availableFlareGuns) { if (flareGun.Sector == player.Sector && new RectangleF(clickLocation, new Size(1, 1)).IntersectsWith(new RectangleF(flareGun.Location, new Size(30, 19)))) { ItemNameLabel.Text = flareGun.ItemName; ItemDescriptionLabel.Text = "Gun to shoot emergency flares indicating ones location" + "\n" + "Inventory Space: " + flareGun.InventorySpace + "\n" + "Flares Left: " + flareGun.PiecesLeft; ItemImage.Image = flareGun.ItemImage; ActionButton1.Text = "Pick Up"; ActionButton2.Text = "Fire Flare"; ItemDetailsPanel.Location = clickLocation; ActionButton1.Enabled = true; ActionButton2.Enabled = true; selectedFlareGun = new FlareGun(flareGun); shouldShowDetails = true; } } foreach (var driftwood in availableDriftwood) { if (driftwood.Sector == player.Sector && new RectangleF(clickLocation, new Size(1, 1)).IntersectsWith(new RectangleF(driftwood.Location, new Size(20, 26)))) { ItemNameLabel.Text = driftwood.ItemName; ItemDescriptionLabel.Text = "A large dry plank of wood" + "\n" + "Inventory Space: " + driftwood.InventorySpace; ItemImage.Image = driftwood.ItemImage; ActionButton1.Text = "Pick Up"; ActionButton2.Text = ""; ItemDetailsPanel.Location = clickLocation; ActionButton1.Enabled = true; ActionButton2.Enabled = false; selectedDriftwood = new Driftwood(driftwood); shouldShowDetails = true; } } foreach (var granolaBar in availableGranolaBars) { if (granolaBar.Sector == player.Sector && new RectangleF(clickLocation, new Size(1, 1)).IntersectsWith(new RectangleF(granolaBar.Location, new Size(30, 17)))) { ItemNameLabel.Text = granolaBar.ItemName; ItemDescriptionLabel.Text = "Simple granola bar that can boost food and energy levels" + "\n" + "Inventory Space: " + granolaBar.InventorySpace; ItemImage.Image = granolaBar.ItemImage; ActionButton1.Text = "Pick Up"; ActionButton2.Text = "Eat Bar"; ItemDetailsPanel.Location = clickLocation; ActionButton1.Enabled = true; ActionButton2.Enabled = true; selectedGranolaBar = new GranolaBar(granolaBar); shouldShowDetails = true; } } foreach (var spoolOfString in availableString) { if (spoolOfString.Sector == player.Sector && new RectangleF(clickLocation, new Size(1, 1)).IntersectsWith(new RectangleF(spoolOfString.Location, new Size(20, 20)))) { ItemNameLabel.Text = spoolOfString.ItemName; ItemDescriptionLabel.Text = "A large spool of strong string" + "\n" + "Inventory Space: " + spoolOfString.InventorySpace; ItemImage.Image = spoolOfString.ItemImage; ActionButton1.Text = "Pick Up"; ActionButton2.Text = ""; ActionButton2.Enabled = false; ItemDetailsPanel.Location = clickLocation; ActionButton1.Enabled = true; selectedString = new String(spoolOfString); shouldShowDetails = true; } } foreach (var fullContainer in availableFullContainers) { if (fullContainer.Sector == player.Sector && new RectangleF(clickLocation, new Size(1, 1)).IntersectsWith(new RectangleF(fullContainer.Location, new Size(14, 28)))) { ItemNameLabel.Text = fullContainer.ItemName; ItemDescriptionLabel.Text = "A container with water in it" + "\n" + "Inventory Space: " + fullContainer.InventorySpace + "\n" + "Kind of Water: " + fullContainer.TypeOfWater; ItemImage.Image = fullContainer.ItemImage; ActionButton1.Text = "Pick Up"; ActionButton2.Text = "Drink Water"; ItemDetailsPanel.Location = clickLocation; ActionButton1.Enabled = true; ActionButton2.Enabled = true; selectedFullContainer = new FullContainer(fullContainer); shouldShowDetails = true; } } foreach (var emptyContainer in availableEmptyContainers) { if (emptyContainer.Sector == player.Sector && new RectangleF(clickLocation, new Size(1, 1)).IntersectsWith(new RectangleF(emptyContainer.Location, new Size(14, 28)))) { ItemNameLabel.Text = emptyContainer.ItemName; ItemDescriptionLabel.Text = "An container that can be used to carry water. When left out in the rain it can collect water." + "\n" + "Inventory Space: " + emptyContainer.InventorySpace; ItemImage.Image = emptyContainer.ItemImage; ActionButton1.Text = "Pick Up"; ActionButton2.Text = ""; ItemDetailsPanel.Location = clickLocation; ActionButton2.Enabled = false; ActionButton1.Enabled = true; selectedEmptyContainer = new EmptyContainer(emptyContainer); shouldShowDetails = true; } } foreach (var firstAidKit in availableFirstAidKits) { if (firstAidKit.Sector == player.Sector && new RectangleF(clickLocation, new Size(1, 1)).IntersectsWith(new RectangleF(firstAidKit.Location, new Size(20, 18)))) { ItemNameLabel.Text = firstAidKit.ItemName; ItemDescriptionLabel.Text = "A kit containing various medical supplies that can treat sicknesses" + "\n" + "Inventory Space: " + firstAidKit.InventorySpace + "\n" + "Medicine Left: " + firstAidKit.PiecesLeft; ItemImage.Image = firstAidKit.ItemImage; ActionButton1.Text = "Pick Up"; ActionButton2.Text = "Use Drugs"; ItemDetailsPanel.Location = clickLocation; ActionButton1.Enabled = true; ActionButton2.Enabled = true; selectedFirstAidKit = new FirstAidKit(firstAidKit); shouldShowDetails = true; } } foreach (var smallRock in availableSmallRocks) { if (smallRock.Sector == player.Sector && new RectangleF(clickLocation, new Size(1, 1)).IntersectsWith(new RectangleF(smallRock.Location, new Size(15, 15)))) { ItemNameLabel.Text = smallRock.ItemName; ItemDescriptionLabel.Text = "A small rock that could be used to create sparks" + "\n" + "Inventory Space: " + smallRock.InventorySpace; ItemImage.Image = smallRock.ItemImage; ActionButton1.Text = "Pick Up"; ActionButton2.Text = ""; ActionButton2.Enabled = false; ItemDetailsPanel.Location = clickLocation; ActionButton1.Enabled = true; selectedSmallRock = new SmallRock(smallRock); shouldShowDetails = true; } } foreach (var berry in availableBerries) { if (berry.Sector == player.Sector && new RectangleF(clickLocation, new Size(1, 1)).IntersectsWith(new RectangleF(berry.Location, new Size(15, 15)))) { ItemNameLabel.Text = berry.ItemName; ItemDescriptionLabel.Text = "Edible berries that can boost food and energy levels" + "\n" + "Inventory Space: " + berry.InventorySpace; ItemImage.Image = berry.ItemImage; ActionButton1.Text = "Pick Up"; ActionButton2.Text = "Eat Berries"; ItemDetailsPanel.Location = clickLocation; ActionButton1.Enabled = true; ActionButton2.Enabled = true; selectedBerries = new Berries(berry); shouldShowDetails = true; } } foreach (var matchbox in availableMatchBoxes) { if (matchbox.Sector == player.Sector && new RectangleF(clickLocation, new Size(1, 1)).IntersectsWith(new RectangleF(matchbox.Location, new Size(20, 11)))) { ItemNameLabel.Text = matchbox.ItemName; ItemDescriptionLabel.Text = "Waterproof matches used to light fires" + "\n" + "Inventory Space: " + matchbox.InventorySpace + "\n" + "Matches Left: " + matchbox.PiecesLeft; ItemImage.Image = matchbox.ItemImage; ActionButton1.Text = "Pick Up"; ActionButton2.Text = "Strike Match"; ItemDetailsPanel.Location = clickLocation; ActionButton1.Enabled = true; ActionButton2.Enabled = true; selectedMatchbox = new Matchbox(matchbox); shouldShowDetails = true; } } if ((ItemDetailsPanel.Location.Y + ItemDetailsPanel.Size.Height) > 900) ItemDetailsPanel.Location = new Point(ItemDetailsPanel.Location.X, 900 - ItemDetailsPanel.Size.Height - 5); if ((ItemDetailsPanel.Location.X + ItemDetailsPanel.Size.Width) > 1440) ItemDetailsPanel.Location = new Point(1440 - ItemDetailsPanel.Size.Width - 5, ItemDetailsPanel.Location.Y); if (shouldShowDetails) { ItemDetailsPanel.Show(); ItemDetailsPanel.Focus(); } else ItemDetailsPanel.Hide(); } else ItemDetailsPanel.Hide(); } #endregion #region Right Mouse Click else if (buttonClicked == MouseButtons.Right) { lastClickWasLeftBtn = false; ActionButton1.Enabled = true; ActionButton2.Enabled = true; if (Math.Sqrt(Math.Pow(clickLocation.X - (player.RealPosition.X + 10), 2) + Math.Pow(clickLocation.Y - (player.RealPosition.Y + 13), 2)) < 40) { ActionButton1.Text = "Put Down"; ActionButton2.Enabled = true; if (player.SelectedItem == "Matchbox") { ItemNameLabel.Text = player.SelectedMatchbox.ItemName; ItemDescriptionLabel.Text = "Waterproof matches used to light fires" + "\n" + "Inventory Space: " + player.SelectedMatchbox.InventorySpace + "\n" + "Matches Left: " + player.SelectedMatchbox.PiecesLeft; ItemImage.Image = player.SelectedMatchbox.ItemImage; ActionButton2.Text = "Strike Match"; ItemDetailsPanel.Location = clickLocation; } else if (player.SelectedItem == "Berries") { ItemNameLabel.Text = player.SelectedBerries.ItemName; ItemDescriptionLabel.Text = "Edible berries that can boost food and energy levels" + "\n" + "Inventory Space: " + player.SelectedBerries.InventorySpace; ItemImage.Image = player.SelectedBerries.ItemImage; ActionButton2.Text = "Eat Berries"; ItemDetailsPanel.Location = clickLocation; } else if (player.SelectedItem == "Small Rock") { ItemNameLabel.Text = player.SelectedSmallRock.ItemName; ItemDescriptionLabel.Text = "A small rock that could be used to create sparks" + "\n" + "Inventory Space: " + player.SelectedSmallRock.InventorySpace; ItemImage.Image = player.SelectedSmallRock.ItemImage; ActionButton2.Text = ""; ActionButton2.Enabled = false; ItemDetailsPanel.Location = clickLocation; } else if (player.SelectedItem == "First Aid Kit") { ItemNameLabel.Text = player.SelectedFirstAidKit.ItemName; ItemDescriptionLabel.Text = "A kit containing various medical supplies that can treat sicknesses" + "\n" + "Inventory Space: " + player.SelectedFirstAidKit.InventorySpace + "\n" + "Medicine Left: " + player.SelectedFirstAidKit.PiecesLeft; ItemImage.Image = player.SelectedFirstAidKit.ItemImage; ActionButton2.Text = "Use Drugs"; ItemDetailsPanel.Location = clickLocation; } else if (player.SelectedItem == "Empty Container") { ItemNameLabel.Text = player.SelectedEmptyContainer.ItemName; ItemDescriptionLabel.Text = "An container that can be used to carry water. When left out in the rain it can collect water" + "\n" + "Inventory Space: " + player.SelectedEmptyContainer.InventorySpace; ItemImage.Image = player.SelectedEmptyContainer.ItemImage; if (new Bitmap(this.BackgroundImage).GetPixel((int)clickLocation.X, (int)clickLocation.Y).B > 200) ActionButton2.Text = "Fill Container"; else { ActionButton2.Text = ""; ActionButton2.Enabled = false; } ItemDetailsPanel.Location = clickLocation; } else if (player.SelectedItem == "Full Container") { ItemNameLabel.Text = player.SelectedFullContainer.ItemName; ItemDescriptionLabel.Text = "A container with water in it" + "\n" + "Inventory Space: " + player.SelectedFullContainer.InventorySpace + "\n" + "Kind of Water: " + player.SelectedFullContainer.TypeOfWater; ItemImage.Image = player.SelectedFullContainer.ItemImage; ActionButton2.Text = "Drink Water"; ItemDetailsPanel.Location = clickLocation; if (new Bitmap(this.BackgroundImage).GetPixel((int)clickLocation.X, (int)clickLocation.Y).B > 200) ActionButton2.Text = "Fill Container"; foreach (var fire in fires) { if (fire.Sector == player.Sector && new RectangleF(clickLocation, new Size(1, 1)).IntersectsWith(new RectangleF(fire.Location, new Size(48, 48))) && !fire.HasBurned) { selectedFire = new Fire(fire); ActionButton2.Text = "Put Out Fire"; } } } else if (player.SelectedItem == "String") { ItemNameLabel.Text = player.SelectedString.ItemName; ItemDescriptionLabel.Text = "A large spool of strong string" + "\n" + "Inventory Space: " + player.SelectedString.InventorySpace; ItemImage.Image = player.SelectedString.ItemImage; ActionButton2.Text = ""; ActionButton2.Enabled = true; ItemDetailsPanel.Location = clickLocation; } else if (player.SelectedItem == "Granola Bar") { ItemNameLabel.Text = player.SelectedGranolaBar.ItemName; ItemDescriptionLabel.Text = "Simple granola bar that can boost food and energy levels" + "\n" + "Inventory Space: " + player.SelectedGranolaBar.InventorySpace; ItemImage.Image = player.SelectedGranolaBar.ItemImage; ActionButton2.Text = "Eat Bar"; ItemDetailsPanel.Location = clickLocation; } else if (player.SelectedItem == "Driftwood") { ItemNameLabel.Text = player.SelectedDriftwood.ItemName; ItemDescriptionLabel.Text = "A large dry plank of wood" + "\n" + "Inventory Space: " + player.SelectedDriftwood.InventorySpace; ItemImage.Image = player.SelectedDriftwood.ItemImage; ActionButton2.Text = ""; ActionButton2.Enabled = false; ItemDetailsPanel.Location = clickLocation; foreach (var fire in fires) { if (fire.Sector == player.Sector && new RectangleF(clickLocation, new Size(1, 1)).IntersectsWith(new RectangleF(fire.Location, new Size(48, 48))) && !fire.HasBurned) { selectedFire = new Fire(fire); ActionButton2.Text = "Add to Fire"; ActionButton2.Enabled = true; } } } else if (player.SelectedItem == "Flare Gun") { ItemNameLabel.Text = player.SelectedFlareGun.ItemName; ItemDescriptionLabel.Text = "Gun to shoot emergency flares indicating ones location" + "\n" + "Inventory Space: " + player.SelectedFlareGun.InventorySpace + "\n" + "Flares Left: " + player.SelectedFlareGun.PiecesLeft; ItemImage.Image = player.SelectedFlareGun.ItemImage; ActionButton2.Text = "Fire Flare"; ItemDetailsPanel.Location = clickLocation; } else if (player.SelectedItem == "Sticks") { ItemNameLabel.Text = player.SelectedSticks.ItemName; ItemDescriptionLabel.Text = "A few sticks that look thin but sturdy" + "\n" + "Inventory Space: " + player.SelectedSticks.InventorySpace; ItemImage.Image = player.SelectedSticks.ItemImage; ActionButton2.Text = ""; ActionButton2.Enabled = false; ItemDetailsPanel.Location = clickLocation; foreach (var fire in fires) { if (fire.Sector == player.Sector && new RectangleF(clickLocation, new Size(1, 1)).IntersectsWith(new RectangleF(fire.Location, new Size(48, 48))) && !fire.HasBurned) { selectedFire = new Fire(fire); ActionButton2.Text = "Add to Fire"; ActionButton2.Enabled = true; } } } else if (player.SelectedItem == "Spear") { ItemNameLabel.Text = player.SelectedSpear.ItemName; ItemDescriptionLabel.Text = "A sharp stick that can pierce flesh" + "\n" + "Inventory Space: " + player.SelectedSpear.InventorySpace; ItemImage.Image = player.SelectedSpear.ItemImage; ActionButton2.Text = "Trow Spear"; ItemDetailsPanel.Location = clickLocation; } else if (player.SelectedItem == "Knife") { ItemNameLabel.Text = player.SelectedKnife.ItemName; ItemDescriptionLabel.Text = "A survival knife that can be used multiple ways" + "\n" + "Inventory Space: " + player.SelectedKnife.InventorySpace; ItemImage.Image = player.SelectedKnife.ItemImage; ActionButton2.Text = "Commit Suicide"; ItemDetailsPanel.Location = clickLocation; foreach (var tree in trees) { if (tree.Sector == player.Sector && new RectangleF(clickLocation, new Size(1, 1)).IntersectsWith(new RectangleF(tree.Location, new Size(99, 89)))) { ActionButton2.Text = "Cut Off Branch"; } } } else if (player.SelectedItem == "Torch") { ItemNameLabel.Text = player.SelectedTorch.ItemName; ItemDescriptionLabel.Text = "When lit, grants you light and fire" + "\n" + "Inventory Space: " + player.SelectedTorch.InventorySpace + "\n" + "Is Lit: " + player.SelectedTorch.IsLit + "\n" + "Has Burned: " + player.SelectedTorch.HasBurned.ToString(); ItemImage.Image = player.SelectedTorch.ItemImage; ActionButton2.Text = ""; ActionButton2.Enabled = false; ItemDetailsPanel.Location = clickLocation; foreach (var fire in fires) { if (fire.Sector == player.Sector && new RectangleF(clickLocation, new Size(1, 1)).IntersectsWith(new RectangleF(fire.Location, new Size(48, 48)))) { selectedFire = new Fire(fire); if (!player.SelectedTorch.IsLit && fire.IsLit && !player.SelectedTorch.HasBurned) ActionButton2.Text = "Light Torch"; if (player.SelectedTorch.IsLit && !fire.IsLit && !fire.HasBurned) ActionButton2.Text = "Light Fire"; ActionButton2.Enabled = true; } } } else if (player.SelectedItem == "Fish") { ItemNameLabel.Text = player.SelectedFish.ItemName; if (player.SelectedFish.IsCooked) ItemDescriptionLabel.Text = "A whole raw fish that is edible" + "\n" + "Inventory Space: " + player.SelectedFish.InventorySpace; else ItemDescriptionLabel.Text = "A whole cooked fish that is safe to eat" + "\n" + "Inventory Space: " + player.SelectedFish.InventorySpace; ItemImage.Image = player.SelectedFish.ItemImage; ActionButton2.Text = "Eat Fish"; ItemDetailsPanel.Location = clickLocation; foreach (var fire in fires) { if (fire.Sector == player.Sector && new RectangleF(clickLocation, new Size(1, 1)).IntersectsWith(new RectangleF(fire.Location, new Size(48, 48))) && !fire.HasBurned) { selectedFire = new Fire(fire); if (!player.SelectedFish.IsCooked) ActionButton2.Text = "Cook Fish"; } } } else if (player.SelectedItem == "Log") { ItemNameLabel.Text = player.SelectedLog.ItemName; ItemDescriptionLabel.Text = "A large, straight piece of wood" + "\n" + "Inventory Space: " + player.SelectedLog.InventorySpace; ItemImage.Image = player.SelectedLog.ItemImage; ActionButton2.Text = ""; ActionButton2.Enabled = false; ItemDetailsPanel.Location = clickLocation; foreach (var fire in fires) { if (fire.Sector == player.Sector && new RectangleF(clickLocation, new Size(1, 1)).IntersectsWith(new RectangleF(fire.Location, new Size(48, 48))) && !fire.HasBurned) { selectedFire = new Fire(fire); ActionButton2.Text = "Add to Fire"; ActionButton2.Enabled = true; } } } else if (player.SelectedItem == "Fishing Rod") { ItemNameLabel.Text = player.SelectedFishingRod.ItemName; ItemDescriptionLabel.Text = "A simple device that enables you to catch fish" + "\n" + "Inventory Space: " + player.SelectedFishingRod.InventorySpace; ItemImage.Image = player.SelectedFishingRod.ItemImage; ActionButton2.Text = "Cast Line"; ItemDetailsPanel.Location = clickLocation; } else if (player.SelectedItem == "Self") { string isWetString = ""; if (player.IsWet) isWetString = "Yes"; else isWetString = "No"; string isSickString = ""; if (player.IsSick) isSickString = "Yes"; else isSickString = "No"; string isAwakeString = ""; if (player.IsAwake) isAwakeString = "Yes"; else isAwakeString = "No"; ItemNameLabel.Text = player.Name; ItemDescriptionLabel.Text = "You. Alone on this island and having to survive." + "\n" + "Are You Awake: " + isAwakeString + "\n" + "Are You Wet: " + isWetString + "\n" + "Are You Sick: " + isSickString; ItemImage.Image = Image.FromFile("Images/Player Images/PlayerDownNeutral.png"); if (player.IsAwake) ActionButton1.Text = "Go to Sleep"; else ActionButton1.Text = "Wake Up"; ActionButton2.Text = ""; ActionButton2.Enabled = false; ItemDetailsPanel.Location = clickLocation; } else if (player.SelectedItem == "Large Rock") { ItemNameLabel.Text = player.SelectedLargeRock.ItemName; ItemDescriptionLabel.Text = "A boulder that you can climb on top of" + "\n" + "Inventory Space: " + player.SelectedLargeRock.InventorySpace; ItemImage.Image = player.SelectedLargeRock.ItemImage; ActionButton2.Text = ""; ActionButton2.Enabled = false; ItemDetailsPanel.Location = clickLocation; } else if (player.SelectedItem == "Leafy Branch") { ItemNameLabel.Text = player.SelectedLeafyBranch.ItemName; ItemDescriptionLabel.Text = "A branch covered in green leaves" + "\n" + "Inventory Space: " + player.SelectedLeafyBranch.InventorySpace + "\n" + "Has Leaves: " + player.SelectedLeafyBranch.HasEatenLeaves.ToString(); ItemImage.Image = player.SelectedLeafyBranch.ItemImage; if (!player.SelectedLeafyBranch.HasEatenLeaves) ActionButton2.Text = "Eat Leaves"; else { ActionButton2.Text = ""; ActionButton2.Enabled = false; } ItemDetailsPanel.Location = clickLocation; foreach (var fire in fires) { if (fire.Sector == player.Sector && new RectangleF(clickLocation, new Size(1, 1)).IntersectsWith(new RectangleF(fire.Location, new Size(48, 48))) && !fire.HasBurned) { selectedFire = new Fire(fire); ActionButton2.Text = "Add to Fire"; ActionButton2.Enabled = true; } } } else if (player.SelectedItem == "Bird") { ItemNameLabel.Text = player.SelectedBird.ItemName; ItemDescriptionLabel.Text = "A bird that has been shot down that must be prepared before eating" + "\n" + "Inventory Space: " + player.SelectedBird.InventorySpace + "\n" + "Is Prepared: " + player.SelectedBird.IsPrepared + "\n" + "Is Cooked: " + player.SelectedBird.IsCooked; ItemImage.Image = player.SelectedBird.ItemImage; if (player.SelectedBird.IsPrepared) ActionButton2.Text = "Eat Bird"; else { ActionButton2.Text = ""; ActionButton2.Enabled = false; } foreach (var fire in fires) { if (fire.Sector == player.Sector && new RectangleF(clickLocation, new Size(1, 1)).IntersectsWith(new RectangleF(fire.Location, new Size(48, 48))) && !fire.HasBurned) { selectedFire = new Fire(fire); if (!player.SelectedBird.IsCooked && !player.SelectedBird.IsPrepared) ActionButton2.Text = "Cook Bird"; } } ItemDetailsPanel.Location = clickLocation; } else if (player.SelectedItem == "Tent") { ItemNameLabel.Text = player.SelectedTent.ItemName; ItemDescriptionLabel.Text = "A high grade structure which will protect you from the elements" + "\n" + "Inventory Space: " + player.SelectedTent.InventorySpace; ItemImage.Image = player.SelectedTent.ItemImageImGame; ActionButton2.Text = ""; ActionButton2.Enabled = false; } ItemDetailsPanel.Location = clickLocation; if ((ItemDetailsPanel.Location.Y + ItemDetailsPanel.Size.Height) > 900) ItemDetailsPanel.Location = new Point(ItemDetailsPanel.Location.X, 900 - ItemDetailsPanel.Size.Height - 5); if ((ItemDetailsPanel.Location.X + ItemDetailsPanel.Size.Width) > 1440) ItemDetailsPanel.Location = new Point(1440 - ItemDetailsPanel.Size.Width - 5, ItemDetailsPanel.Location.Y); ItemDetailsPanel.Focus(); ItemDetailsPanel.Show(); } else ItemDetailsPanel.Hide(); } #endregion }