void FinishCollectionProcess() { Inventory.Instance.OnItemCollected(this, amount); if (WorldInfo.Instance.IsInDungeon) { DungeonRoom dr = DungeonRoom.GetRoomForPosition(transform.position); if (dr != null) { dr.OnItemCollectedWithinThisRoom(this); } } else if (WorldInfo.Instance.IsOverworld) { if (Grotto != null) { Grotto.OnGrottoItemCollected(this); } if (SpawnPoint != null) { SpawnPoint.OnItemCollected(this); } } if (isSpecialItem) { SaveManager.Instance.SaveGame(); } if (destroyOnCollect) { Destroy(gameObject); } }
void PayForInfo(int rupeeTriggerID) { int payAmount = 0; switch (rupeeTriggerID) { case 0: payAmount = GrottoSpawnPoint.saleItemPriceA; break; case 1: payAmount = GrottoSpawnPoint.saleItemPriceB; break; case 2: payAmount = GrottoSpawnPoint.saleItemPriceC; break; default: break; } Inventory inv = Inventory.Instance; if (!inv.TrySpendRupees(payAmount)) { return; } ShowTheGoods(false); string info = GrottoSpawnPoint.payForInfoText[rupeeTriggerID]; Grotto.DisplayMessage(true, info); _hasMadePurchase = true; }
public void OnPlayerExit() { if (!PlayerIsInside) { return; } PlayerIsInside = false; OccupiedGrotto = null; if (WorldInfo.Instance.IsOverworld) { RenderSettings.fog = _storedFogSetting; } if (!Music.Instance.IsPlaying) { Music.Instance.PlayAppropriateMusic(); } PlaySound_Stairs(); ShowFlames(false); ShowNpc(false); DisplayMessage(false); Extension.ShowTheGoods(false); Extension.OnPlayerExit(); }
void InstantiateSalesItems() { GrottoSpawnPoint gsp = GrottoSpawnPoint; for (int i = 0; i < gsp.SaleItemPrefabs.Count; i++) { Collectible cPrefab = gsp.SaleItemPrefabs[i]; SaleItemView v = _saleItemViews[i]; // TODO: Instantiate these dynamically if (cPrefab == null || v == null) { continue; } cPrefab.riseUpWhenCollected = false; int price = gsp.SaleItemPrices[i]; string cName = cPrefab.itemPrefab.name; Item item = Inventory.Instance.GetItem(cName); if (!item.IsMaxedOut) { Collectible c = Grotto.InstantiateItem(cPrefab.gameObject, v.transform, price); c.name = cName; _salesItems.Add(c); } string priceText = price.ToString(); v.UpdatePriceText(priceText); v.gameObject.SetActive(!item.IsMaxedOut); } }
void ShowTheUniqueItem(bool doShow = true) { if (_uniqueCollectibleItem == null) { _uniqueCollectibleItem = Grotto.InstantiateItem(UniqueCollectiblePrefab.gameObject, _uniqueItemContainer); } _uniqueItemContainer.gameObject.SetActive(doShow); }
override public void ShowTheGoods(bool doShow = true) { Inventory.Instance.TrySpendRupees(-GiftAmount); ShowRupeeDeduction(doShow); Grotto.DisplayMessage(doShow); }
public Grotto SpawnGrotto() { if (SpawnedGrotto != null) { //Debug.LogWarning("SpawnedGrotto already exists. It will be Destroyed and replaced with a new instance."); DestroyGrotto(); } SpawnedGrotto = InstantiateGrotto(); return(SpawnedGrotto); }
public void DestroyGrotto() { if (SpawnedGrotto == null) { return; } Destroy(SpawnedGrotto.gameObject); SpawnedGrotto = null; }
void ShowGift(bool doShow = true) { if (_giftItem == null) { Collectible c = GiftPrefab; if (c != null) { _giftItem = Grotto.InstantiateItem(c.gameObject, _giftContainer); } } _giftTextDisplay.Text = GiftAmount.ToString(); _giftContainer.gameObject.SetActive(doShow); }
void PlayerUsedLetter() { if (HasDeliveredLetterToOldWoman) { return; } Grotto gr = Grotto.OccupiedGrotto; if (gr != null && gr.Type == Grotto.GrottoType.Medicine) { gr.DeliverLetter(); } }
Grotto InstantiateGrotto() { GameObject g = Instantiate(grottoPrefab, transform.position, transform.rotation) as GameObject; g.name = "Grotto - " + grottoType.ToString(); g.transform.SetParent(_grottosContainer); Grotto gr = g.GetComponent <Grotto>(); gr.GrottoSpawnPoint = this; gr.Type = grottoType; return(gr); }
void WarpToPortalInsideGrotto(GrottoPortal fromPortal) { Player player = CommonObjects.Player_C; ZeldaPlayerController pc = player.PlayerController; GrottoSpawnPoint warpToGrottoSP = null; Transform warpToLocation = null; Grotto destinationGrotto = null; if (fromPortal == Grotto.warpA) { warpToGrottoSP = GrottoSpawnPoint.warpToA; destinationGrotto = warpToGrottoSP.SpawnGrotto(); warpToLocation = destinationGrotto.warpA.transform; } else if (fromPortal == Grotto.warpB) { warpToGrottoSP = GrottoSpawnPoint.warpToB; destinationGrotto = warpToGrottoSP.SpawnGrotto(); warpToLocation = destinationGrotto.warpB.transform; } else if (fromPortal == Grotto.warpC) { warpToGrottoSP = GrottoSpawnPoint.warpToC; destinationGrotto = warpToGrottoSP.SpawnGrotto(); warpToLocation = destinationGrotto.warpC.transform; } Vector3 eulerDiff = warpToLocation.eulerAngles - fromPortal.transform.eulerAngles; Transform t = pc.transform; Vector3 offset = t.position - fromPortal.transform.position; offset = Quaternion.Euler(eulerDiff) * offset; t.position = warpToLocation.position + offset; Vector3 newEuler = pc.transform.eulerAngles + eulerDiff; player.ForceNewRotation(newEuler); pc.Stop(); OnPlayerExit(); destinationGrotto.OnPlayerEnter(); }
override public void ShowTheGoods(bool doShow = true) { ShowPayForInfoChoices(doShow); Grotto.DisplayMessage(doShow); }
public void OnPlayerEnter() { if (PlayerIsInside) { return; } PlayerIsInside = true; OccupiedGrotto = this; if (WorldInfo.Instance.IsOverworld) { _storedFogSetting = RenderSettings.fog; RenderSettings.fog = false; } PlaySound_Stairs(); Music.Instance.Stop(); ShowFlames(); ShowNpc(); Extension.OnPlayerEnter(); if (Extension.ShouldShowTheGoods) { Extension.ShowTheGoods(); } /*bool doShowTheGoods = true; * * if (Type == GrottoType.UniqueItem) * { * doShowTheGoods = !_grottoSpawnPoint.HasSpecialResourceBeenTapped; * } * else if (Type == GrottoType.Medicine) * { * doShowTheGoods = Inventory.Instance.HasDeliveredLetterToOldWoman; * } * else if (Type == GrottoType.Gift) * { * doShowTheGoods = !_grottoSpawnPoint.HasSpecialResourceBeenTapped; * } * else if (Type == GrottoType.PayRupees) * { * Inventory.Instance.SpendRupees(-_grottoSpawnPoint.giftAmount); * } * else if (Type == GrottoType.Warp) * { * WarpsActive = true; * } * else if (Type == GrottoType.HeartContainer) * { * doShowTheGoods = !_grottoSpawnPoint.HasSpecialResourceBeenTapped; * } * * if (doShowTheGoods) * { * ShowTheGoods(); * }*/ }
override public void OnGrottoItemCollected(Collectible c) { Grotto.FadeAwayNpc(); HasSpecialResourceBeenTapped = true; }
override public void ShowTheGoods(bool doShow = true) { ShowGift(doShow); Grotto.DisplayMessage(doShow); }
virtual public void ShowTheGoods(bool doShow = true) { Grotto.DisplayMessage(doShow); }
override public void ShowTheGoods(bool doShow = true) { ShowTheShopItems(doShow); Grotto.DisplayMessage(!IsSoldOut); }