Пример #1
0
    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);
        }
    }
Пример #2
0
    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;
    }
Пример #3
0
    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();
    }
Пример #4
0
    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);
        }
    }
Пример #5
0
 void ShowTheUniqueItem(bool doShow = true)
 {
     if (_uniqueCollectibleItem == null)
     {
         _uniqueCollectibleItem = Grotto.InstantiateItem(UniqueCollectiblePrefab.gameObject, _uniqueItemContainer);
     }
     _uniqueItemContainer.gameObject.SetActive(doShow);
 }
Пример #6
0
    override public void ShowTheGoods(bool doShow = true)
    {
        Inventory.Instance.TrySpendRupees(-GiftAmount);

        ShowRupeeDeduction(doShow);

        Grotto.DisplayMessage(doShow);
    }
Пример #7
0
 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);
 }
Пример #8
0
    public void DestroyGrotto()
    {
        if (SpawnedGrotto == null)
        {
            return;
        }

        Destroy(SpawnedGrotto.gameObject);
        SpawnedGrotto = null;
    }
Пример #9
0
 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);
 }
Пример #10
0
    void PlayerUsedLetter()
    {
        if (HasDeliveredLetterToOldWoman)
        {
            return;
        }

        Grotto gr = Grotto.OccupiedGrotto;

        if (gr != null && gr.Type == Grotto.GrottoType.Medicine)
        {
            gr.DeliverLetter();
        }
    }
Пример #11
0
    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);
    }
Пример #12
0
    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();
    }
Пример #13
0
    override public void ShowTheGoods(bool doShow = true)
    {
        ShowPayForInfoChoices(doShow);

        Grotto.DisplayMessage(doShow);
    }
Пример #14
0
    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();
         * }*/
    }
Пример #15
0
 override public void OnGrottoItemCollected(Collectible c)
 {
     Grotto.FadeAwayNpc();
     HasSpecialResourceBeenTapped = true;
 }
Пример #16
0
    override public void ShowTheGoods(bool doShow = true)
    {
        ShowGift(doShow);

        Grotto.DisplayMessage(doShow);
    }
Пример #17
0
 virtual public void ShowTheGoods(bool doShow = true)
 {
     Grotto.DisplayMessage(doShow);
 }
Пример #18
0
    override public void ShowTheGoods(bool doShow = true)
    {
        ShowTheShopItems(doShow);

        Grotto.DisplayMessage(!IsSoldOut);
    }