internal Rod(IReadonlyAdventureGame game, params string[] nouns) : base(game, nouns) { ItemId = Item.Rod; Name = "black *rod* with a rusty star on one end"; PluralName = "black *rods* with rusty stars on the ends"; IsActive = true; Contents = new List <IAdventureItem>(); IsPortable = true; // Using the rod when at the fissure, creates a crystal bridge var use = new ItemInteraction(Game, "use", "wave"); use.RegisteredInteractions.Add(new DisplayForLocation("You wave the rod with a flourish. The air shimmers and a beautiful crystal bridge appears, spanning the fissure to the west!", Location.FissureEast)); use.RegisteredInteractions.Add(new DisplayForLocation("You wave the rod with a flourish.. The air shimmers and a beautiful crystal bridge appears, spanning the fissure to the east!!", Location.FissureWest)); use.RegisteredInteractions.Add(new AddToLocation(ItemFactory.GetInstance(Game, Item.CrystalBridge))); use.RegisteredInteractions.Add(new AddMoves(new List <IPlayerMove> { new PlayerMove("You cautiously cross the crystal bridge...", Location.FissureWest, "west", "w", "bridge"), }, Game, Location.FissureEast)); use.RegisteredInteractions.Add(new AddMoves(new List <IPlayerMove> { new PlayerMove("You step out onto the crystal bridge...", Location.FissureEast, "east", "e", "bridge"), }, Game, Location.FissureWest)); Interactions.Add(use); }
private Grate(IReadonlyAdventureGame game, params string[] nouns) : base(game, nouns) { ItemId = Item.Grate; Name = "strong steel grate"; PluralName = "strong steel grates"; IsPortable = false; IsOpen = false; IsLocked = true; ItemIdToUnlock = Item.Key; var open = new ItemInteraction(Game, "open"); open.RegisteredInteractions.Add(new Open()); Interactions.Add(open); var unlock = new ItemInteraction(Game, "unlock"); unlock.RegisteredInteractions.Add(new Unlock()); unlock.RegisteredInteractions.Add(new DisplayForLocation("You open the grate and see a dark space below it. A rusty iron ladder leads down into pitch blackness!", Location.Depression)); unlock.RegisteredInteractions.Add(new DisplayForLocation("You open the grate and see the way out of the caves above you. A rusty iron ladder leads up to the daylight!", Location.Cave1)); unlock.RegisteredInteractions.Add(new AddMoves(new List <IPlayerMove> { new PlayerMove("With growing trepidation, you descend the ladder...", Location.Cave1, "down", "d", "ladder", "underground"), }, Game, Location.Depression)); unlock.RegisteredInteractions.Add(new AddMoves(new List <IPlayerMove> { new PlayerMove("You climb the rusty ladder and emerge into the light!", Location.Depression, "up", "ladder", "surface", "climb"), }, Game, Location.Cave1)); Interactions.Add(unlock); }
internal Bird(IReadonlyAdventureGame game, params string[] nouns) : base(game, nouns) { ItemId = Item.Bird; Name = "little *bird* singing cheerfully"; PluralName = "little *birds* singing cheerfully"; IsPortable = true; IsActive = true; MustBeContainedIn = Item.Cage; Slots = 0; PreventTakeItemId = Item.Rod; PreventTakeText = "The *bird* was unafraid when you entered, but as you approach " + "it becomes disturbed and you cannot catch it."; var free = new ItemInteraction(Game, "use", "free", "release"); free.RegisteredInteractions.Add(new Display("You open the cage and the bird flies out.")); free.RegisteredInteractions.Add(new RemoveFromInventory()); free.RegisteredInteractions.Add(new AddToLocation(this)); Interactions.Add(free); var catchInteraction = new ItemInteraction(Game, "catch", "capture", "trap"); catchInteraction.RegisteredInteractions.Add(new AliasCommand(new Take(game, "take"))); Interactions.Add(catchInteraction); }
internal Lamp(IReadonlyAdventureGame game, params string[] nouns) : base(game, nouns) { ItemId = Item.Lamp; Name = "battered *lamp*";; PluralName = "battered *lamps*"; IsPortable = true; IsEndlessSupply = false; Slots = 0; // Takes up no space in inventory var light = new ItemInteraction(Game, "light"); light.RegisteredInteractions.Add(new ActivateItem("The lamp shines brightly.")); light.RegisteredInteractions.Add(new UpdateItemName("battered *lamp* which is lit")); light.RegisteredInteractions.Add(new AddPlayerStatus(PlayerStatus.HasLight)); Interactions.Add(light); var extinguish = new ItemInteraction(Game, "extinguish", "ext"); extinguish.RegisteredInteractions.Add(new DeactivateItem("The lamp turns off.")); extinguish.RegisteredInteractions.Add(new UpdateItemName("battered *lamp*")); extinguish.RegisteredInteractions.Add(new RemovePlayerStatus(PlayerStatus.HasLight)); Interactions.Add(extinguish); }
// Use this for initialization void Start() { dogC = dog.GetComponent <DogControls> (); doorC = door.GetComponent <ItemInteraction> (); elevatorC = elevator.GetComponent <ItemInteraction> (); cameraC = camera.GetComponent <LightSoundControl> (); }
public void MouthButton() { for (int i = 0; i < optionsImages.Length; i++) { optionsImages[i].CrossFadeAlpha(0, 0.25f, false); showingMenu = false; } if (currentItem != null) { DialogueManager.Instance.StartDialogue(currentItem.Mouth, currentItem.VoiceOversMouth); } if (currentDoor != null) { DialogueManager.Instance.StartDialogue(currentDoor.Mouth, currentDoor.VoiceOversMouth); } if (currentGhost != null && GhostInteraction.Saveable) { DialogueManager.Instance.StartDialogue(currentGhost.MouthSaveable, currentGhost.VoiceOversSaveable); currentGhost.Ghost.material = currentGhost.Happy; foreach (ParticleSystem p in currentGhost.Tears) { p.Stop(); } StartCoroutine(door.Open(openDoor.transform.rotation)); } else if (currentGhost != null) { DialogueManager.Instance.StartDialogue(currentGhost.Mouth, currentGhost.VoiceOversMouth); } currentItem = null; currentGhost = null; currentDoor = null; }
public void Add(Item item) { foreach (Slot s in InventorySlots) { if (!s.Empty) { continue; } else { s.Item = item; s.Empty = false; Images[s.SlotNumber].gameObject.AddComponent <ItemInteraction>(); ItemInteraction interaction = Images[s.SlotNumber].gameObject.GetComponent <ItemInteraction>(); interaction.Name = item.ItemInteraction.Name; interaction.Mouth = item.ItemInteraction.Mouth; interaction.Eyes = item.ItemInteraction.Eyes; interaction.HandAfterPickup = item.ItemInteraction.HandAfterPickup; interaction.Hand = item.ItemInteraction.HandAfterPickup; interaction.Image = item.ItemInteraction.Image; interaction.VoiceOversMouth = item.ItemInteraction.VoiceOversMouth; interaction.VoiceOversEyes = item.ItemInteraction.VoiceOversEyes; interaction.VoiceOversHand = item.ItemInteraction.VoiceOversHand; Images[s.SlotNumber].gameObject.GetComponent <Button>().onClick.AddListener(delegate { OnUseItem(interaction); }); break; } } Draw(); }
internal Bottle(IReadonlyAdventureGame game, params string[] nouns) : base(game, nouns) { ItemId = Item.Bottle; Name = "small glass *bottle*"; PluralName = "small glass *bottles*"; IsContainer = true; IsPortable = true; IsTransparent = true; var smash = new ItemInteraction(Game, "smash", "break"); smash.RegisteredInteractions.Add(new Display("You smash the bottle and glass flies everywhere!")); smash.RegisteredInteractions.Add(new RemoveFromInventory()); smash.RegisteredInteractions.Add(new AddToLocation(new BrokenGlass(Game))); Interactions.Add(smash); var fill = new ItemInteraction(Game, "fill"); fill.RegisteredInteractions.Add(new Display("You reach down and fill the bottle with water.")); fill.RegisteredInteractions.Add(new AddToItemContents(ItemFactory.GetInstance(Game, Item.PintOfWater))); Interactions.Add(fill); //var empty = new ItemInteraction(Game, "empty", "pour");); //Interactions.Add(empty); }
public void OnUseItem(ItemInteraction i) { if (!i.Name.Contains(" in inventory")) { i.Name = i.Name + " in inventory"; } RadialMenu(i); }
public static bool isInBag(ItemInteraction item) { bool found=false; for (int i = 0; i < objects.Count && !found; i++) { found = (objects[i] == item.gameObject); } return found; }
public Item(string name, string[] eyes, string[] mouth, string[] hand, string[] handAfterPickup, Sprite image, ItemInteraction itemInteraction) { Name = name; Eyes = eyes; Mouth = mouth; Hand = hand; HandAfterPickup = handAfterPickup; Image = image; ItemInteraction = itemInteraction; }
//Controls the menu object's scaling. public void setItemScale() { //If the game object is selected and exists...(not null) if (selectedMenuObject != null) { //Get the item interaction script and set the scaling of the item. ItemInteraction objcIntS = selectedMenuObject.GetComponent <ItemInteraction>(); objcIntS.movementSetting = itemMovementType.scale; } }
internal Troll(IReadonlyAdventureGame game, params string[] nouns) : base(game, nouns) { ItemId = Item.Troll; Name = "large troll barring your way"; PluralName = "large trolls barring your way"; IsCreature = true; var kill = new ItemInteraction(Game, "kill", "slay", "murder", "attack"); Interactions.Add(kill); }
internal ShadowyFigure(IReadonlyAdventureGame game, params string[] nouns) : base(game, nouns) { ItemId = Item.ShadowyFigure; Name = "shadowy *figure* peering at you through the window"; PluralName = "shadowy *figures* peering at you through the window"; IsPortable = false; var wave = new ItemInteraction(Game, "wave"); wave.RegisteredInteractions.Add(new Display("The shadowy figure waves back at you. Is it trying to get your attention?")); Interactions.Add(wave); }
public void deliver(ItemInteraction item) { item.playSound(); this.shelve.GetComponent <ShelveInteraction>().storeItem(); ScoreScript.score += 3; // far away item.transform.position = new Vector2(item.transform.position.x, item.transform.position.y + 100); // Trigger in 5 seconds StartCoroutine(this.respawnItem(item)); }
internal Water(IReadonlyAdventureGame game, params string[] nouns) : base(game, nouns) { ItemId = Item.PintOfWater; Name = "source of *water*"; PluralName = "source of *water*"; IsPortable = false; MustBeContainedIn = Item.None; var drink = new ItemInteraction(Game, "drink"); drink.RegisteredInteractions.Add(new Display("Mmmmm, refreshing!")); Interactions.Add(drink); }
internal PintOfWater(IReadonlyAdventureGame game, params string[] nouns) : base(game, nouns) { ItemId = Item.PintOfWater; Name = "pint of *water*"; PluralName = "pints of *water*"; IsPortable = false; IsEndlessSupply = true; MustBeContainedIn = Item.Bottle; var drink = new ItemInteraction(Game, "drink"); Interactions.Add(drink); }
internal Troll(IReadonlyAdventureGame game, params string[] nouns) : base(game, nouns) { ItemId = Item.Troll; Name = "large troll barring your way"; PluralName = "large trolls barring your way"; // Player says yes to attacking with bare hands... var yes = new ItemInteraction(Game, "yes"); yes.RegisteredInteractions.Add(new RemovePlayerItemState("attack")); yes.RegisteredInteractions.Add(new Display("As you approach the hideous troll, it points at its sign and yells 'Pay troll!'")); yes.RegisteredInteractions.Add(new Display("The creature's foul breath drives you back, gasping for air.")); Interactions.Add(yes); }
internal Vase(IReadonlyAdventureGame game, params string[] nouns) : base(game, nouns) { ItemId = Item.Vase; Name = "delicate precious Ming *vase*"; PluralName = "delicate precious Ming *vases*"; IsPortable = true; IsTreasure = true; var smash = new ItemInteraction(Game, "smash", "break"); smash.RegisteredInteractions.Add(new Display("You smash the vase and pieces fly everywhere!")); smash.RegisteredInteractions.Add(new RemoveFromInventory()); smash.RegisteredInteractions.Add(new AddToLocation(new BrokenVase(Game))); Interactions.Add(smash); }
internal Snake(IReadonlyAdventureGame game, params string[] nouns) : base(game, nouns) { ItemId = Item.Snake; Name = "large vicious-looking snake barring your way"; PluralName = "large vicious-looking snakes barring your way"; // Player says yes to attacking with bare hands... var yes = new ItemInteraction(Game, "yes"); yes.RegisteredInteractions.Add(new RemovePlayerItemState("attack")); yes.RegisteredInteractions.Add(new Display("You lunge at the snake, trying to grapple with it...")); yes.RegisteredInteractions.Add(new Display("The snake sinks its envenomed fangs into your softly yielding flesh")); yes.RegisteredInteractions.Add(new PlayerDies(game)); Interactions.Add(yes); }
// Update is called once per frame void Update() { if (ScoreScript.gameOver) { return; } // Get objects around player Collider2D[] objectsNearPlayer = Physics2D.OverlapCircleAll(this.transform.position, this.radius); // Check player interaction foreach (Collider2D collider in objectsNearPlayer) { if (!this._grabbing && collider.CompareTag("ITEM")) { // Pick up item this._heldItem = collider; this._grabbing = true; // Pick up sound AudioSource audioSource = collider.GetComponent <AudioSource>(); audioSource.Play(); } else if (this._grabbing && collider.CompareTag("DELIVERY")) { // Release held item ItemInteraction item = this._heldItem.gameObject.GetComponent <ItemInteraction>(); DeliveryInteraction delivery = collider.gameObject.GetComponent <DeliveryInteraction>(); if (delivery.checkColor(item.color)) { this.throwItem(); delivery.deliver(item); } } else if (collider.CompareTag("CUSTOMER")) { // Slow down PlayerMovement movement = this.GetComponent <PlayerMovement>(); movement.customerInteraction(); } } // Carry item if (this._grabbing) { this._heldItem.transform.position = new Vector2(this.transform.position.x, (this.transform.position.y + 1.1f)); } }
internal Lamp(IReadonlyAdventureGame game, params string[] nouns) : base(game, nouns) { ItemId = Item.Lamp; Name = "battered *lamp*";; PluralName = "battered *lamps*"; IsPortable = true; IsEndlessSupply = true; var light = new ItemInteraction(Game, "light"); light.RegisteredInteractions.Add(new ActivateItem("The lamp shines brightly.")); light.RegisteredInteractions.Add(new UpdateItemName("battered *lamp* which is lit")); light.RegisteredInteractions.Add(new AddPlayerStatus(PlayerStatus.HasLight)); Interactions.Add(light); }
internal LittleAxe(IReadonlyAdventureGame game, params string[] nouns) : base(game, nouns) { ItemId = Item.LittleAxe; Name = "small *axe*"; PluralName = "small *axes*"; IsPortable = true; IsWeapon = true; var use = new ItemInteraction(Game, "use", "swing", "throw", "wield"); use.RegisteredInteractions.Add(new Display("You attack the dwarf, throwing the little axe at it!!")); use.RegisteredInteractions.Add(new RemoveFromInventory()); use.RegisteredInteractions.Add(new Chance(80)); Interactions.Add(use); }
internal Coins(IReadonlyAdventureGame game, params string[] nouns) : base(game, nouns) { ItemId = Item.Coins; Name = "pile of *coins*"; PluralName = "piles of *coins*"; IsPortable = true; IsTreasure = true; var pay = new ItemInteraction(Game, "use", "spend", "insert"); pay.RegisteredInteractions.Add(new RemoveFromInventory()); pay.RegisteredInteractions.Add(new AddToLocation(ItemFactory.GetInstance(Game, Item.Batteries))); pay.RegisteredInteractions.Add(new Display("You insert your coins into the machine, and a pack of batteries is dispensed!")); Interactions.Add(pay); }
internal Leaflet(IReadonlyAdventureGame game, params string[] nouns) : base(game, nouns) { ItemId = Item.Leaflet; Name = "*leaflet*"; PluralName = "*leaflets*"; IsPortable = true; var whenRead = new StringBuilder("You read the leaflet and this is what it says:"); whenRead.AppendLine(); whenRead.AppendLine("Somewhere nearby lies the fabled Colossal Cave, a place of danger, mystery and, some say, magic."); whenRead.AppendLine("Rumours are that some have found gold in the caves. Other rumours say that no one who goes in ever comes out again..."); var read = new ItemInteraction(Game, "read"); read.RegisteredInteractions.Add(new Display(whenRead.ToString())); Interactions.Add(read); }
internal VendingMachine(IReadonlyAdventureGame game, params string[] nouns) : base(game, nouns) { ItemId = Item.VendingMachine; Name = "vending machine selling batteries"; PluralName = "vending machines selling batteries"; IsOpen = false; IsContainer = false; var push = new ItemInteraction(Game, "push", "shove", "move", "slide"); push.RegisteredInteractions.Add(new AddMoves(new List <IPlayerMove> { new PlayerMove(string.Empty, Location.RoughHewn, "south", "s"), }, Game)); push.RegisteredInteractions.Add(new Display("You give a mighty heave on the machine, and it slides aside, revealing a passageway heading South...")); Interactions.Add(push); }
internal Batteries(IReadonlyAdventureGame game, params string[] nouns) : base(game, nouns) { ItemId = Item.Batteries; Name = "packet of fresh *batteries*"; PluralName = "packets of fresh *batteries"; IsPortable = true; IsEndlessSupply = false; var installBatteries = new ItemInteraction(Game, "use", "install", "fit", "renew", "refresh"); installBatteries.RegisteredInteractions.Add(new RemoveFromInventory()); installBatteries.RegisteredInteractions.Add(new Display("You fit the fresh batteries into your lamp!")); installBatteries.RegisteredInteractions.Add(new ActivateItem("The lamp shines brightly.")); installBatteries.RegisteredInteractions.Add(new UpdateItemName("battered *lamp* which is lit")); installBatteries.RegisteredInteractions.Add(new AddPlayerStatus(PlayerStatus.HasLight)); installBatteries.RegisteredInteractions.Add(new AddToLocation(ItemFactory.GetInstance(Game, Item.SpentBatteries))); installBatteries.RegisteredInteractions.Add(new UpdateEventRecord(EventIds.HasLamp, 2000)); Interactions.Add(installBatteries); }
internal Cage(IReadonlyAdventureGame game, params string[] nouns) : base(game, nouns) { ItemId = Item.Cage; Name = "wicker *cage*"; PluralName = "wicker *cages*"; IsOpen = true; IsContainer = true; Contents = new List <IAdventureItem>(); IsPortable = true; IsTransparent = true; var open = new ItemInteraction(Game, "open"); open.RegisteredInteractions.Add(new Open()); Interactions.Add(open); var close = new ItemInteraction(Game, "close", "shut"); close.RegisteredInteractions.Add(new Close()); Interactions.Add(close); }
private void PlayInteraction(ItemInteraction p_interaction, int p_playerId) { if (!string.IsNullOrEmpty(p_interaction.messageWhenActivated)) { if (p_playerId == playersManager.activePlayer.id) { UIManager.CreateMessage(p_interaction.messageWhenActivated, MessageColor.BLUE); } //else // UIManager.CreateMessage(p_interaction.messageWhenActivated, MessageColor.BLUE); } foreach (InteractionChangeItemDescription __interaction in p_interaction.changeItemDescriptions) { __interaction.target.itemDescription = __interaction.newDescription; } foreach (InteractionMoveItem __interaction in p_interaction.moveItems) { if (__interaction.oldRoom != null) { __interaction.oldRoom.items.Remove(__interaction.target); } if (__interaction.newRoom != null) { __interaction.newRoom.items.Add(__interaction.target); } } foreach (InteractionChangeRoomDescription __interaction in p_interaction.changeRoomDescriptions) { __interaction.target.roomDescription = __interaction.newDescription; } foreach (InteractionChangeRoomTransitionLocked __interaction in p_interaction.changeRoomTransition) { __interaction.target.adjacentRooms[(int)__interaction.direction].isLocked = __interaction.isLocked; } p_interaction.active = false; }
public void ExamineButton() { for (int i = 0; i < optionsImages.Length; i++) { optionsImages[i].CrossFadeAlpha(0, 0.25f, false); showingMenu = false; } if (currentItem != null) { DialogueManager.Instance.StartDialogue(currentItem.Eyes, currentItem.VoiceOversEyes); } if (currentGhost != null) { DialogueManager.Instance.StartDialogue(currentGhost.Eyes, currentGhost.VoiceOversEyes); } if (currentDoor != null) { DialogueManager.Instance.StartDialogue(currentDoor.Eyes, currentDoor.VoiceOversEyes); } currentItem = null; currentGhost = null; currentDoor = null; }
internal Dragon(IReadonlyAdventureGame game, params string[] nouns) : base(game, nouns) { ItemId = Item.Dragon; Name = "huge fierce green dragon blocking your way! The dragon is sprawled out on an expensive-looking Persian rug lying"; PluralName = "huge fierce green dragon blocking the way! The dragon is sprawled out on an expensive-looking Persian rug lying"; IsPortable = false; // Player says yes to attacking with bare hands... var yes = new ItemInteraction(Game, "yes"); yes.RegisteredInteractions.Add(new RemovePlayerItemState("attack")); yes.RegisteredInteractions.Add(new Display("Congratulations! You have just vanquished a dragon with your bare " + "hands! (Unbelievable, isn't it?)")); yes.RegisteredInteractions.Add(new RemoveFromLocation(this)); yes.RegisteredInteractions.Add(new AddToLocation(ItemFactory.GetInstance(Game, Item.DeadDragon))); yes.RegisteredInteractions.Add(new StartClock("dragon")); yes.RegisteredInteractions.Add(new RemoveDestination(Game, Location.SecretNorthEastCanyon)); yes.RegisteredInteractions.Add(new AddMoves(new List <IPlayerMove> { new PlayerMove(string.Empty, Location.SecretNorthSouthCanyon, "north", "n") }, Game, Location.SecretNorthEastCanyon)); Interactions.Add(yes); }
public static void removeItem(ItemInteraction item) { objects.Remove(item.gameObject); }
public static void storeItem(ItemInteraction item) { objects.Add(item.gameObject); }