예제 #1
0
    public void Sell() //2 DO HERE : BASE ECONOMY INCREASE ON DAY PASSED && IF PET IS DEAD SELL FOR 1$
    {
        shopLogic.IncreaseEconomy(Convert.ToInt32(price.text));
        sold.SetActive(true);
        this.GetComponent <Button>().interactable = false;



        GameObject aux = shopLogic.actualSoldPets[index].gameObject;

        Debug.Log("ListCount: " + shopLogic.actualSoldPets.Count);
        //update shops positions :
        for (int i = 0; i < roomsLogic.roomsGameobjects.Count; i++)
        {
            roomsLogic.roomsGameobjects[i].transform.position = roomsLogic.gridPositions[i];
        }
        roomsLogic.i--;
        shopLogic.actualSoldPets.RemoveAt(index);
        shopLogic.actualHoldingPets.RemoveAt(index);
        Destroy(aux);
        shop.GetComponent <ShopButtons>().BuyButtonClick();
        shopLogic.ShowUIPiece(buttonShop);
        shopLogic.ShowUIPiece(economy_ui);
        shopLogic.ShowUIPiece(lockUnlock);
        shopLogic.CloseShop(shop);
        shopLogic.ResetSellGameObjectList();
        //
    }
예제 #2
0
    void Update()
    {
        if (actualPetInfo.hpLvl >= 0)
        {
            dayTimePassed += Time.deltaTime;

            waterTimePassed += Time.deltaTime;
            foodTimePassed  += Time.deltaTime;
            gamesTimePassed += Time.deltaTime;
            sleepTimePassed += Time.deltaTime;

            if (waterTimePassed >= actualPetInfo.waterTimeLoss * 60 && actualPetInfo.waterLvl >= 0)
            {
                actualPetInfo.waterLvl--;
                waterTimePassed = 0;
                actualPetInfo.UpdateVisuals(actualPetInfo.waterLvl, actualPetInfo.pointsLists.waterPoints);
                actualPetInfo.ChangeMaterial(0);
                ShakeCam();
                StartCoroutine(resetMat());
            }
            if (foodTimePassed >= actualPetInfo.foodTimeLoss * 60 && actualPetInfo.foodLvl >= 0)
            {
                actualPetInfo.foodLvl--;
                foodTimePassed = 0;
                actualPetInfo.UpdateVisuals(actualPetInfo.foodLvl, actualPetInfo.pointsLists.foodPoints);
                actualPetInfo.ChangeMaterial(1);
                ShakeCam();
                StartCoroutine(resetMat());
            }
            if (gamesTimePassed >= actualPetInfo.gamesTimeLoss * 60 && actualPetInfo.happynessLvl >= 0)
            {
                actualPetInfo.happynessLvl--;
                gamesTimePassed = 0;
                actualPetInfo.UpdateVisuals(actualPetInfo.happynessLvl, actualPetInfo.pointsLists.gamesPoints);
                actualPetInfo.ChangeMaterial(2);
                ShakeCam();
                StartCoroutine(resetMat());
            }
            if (sleepTimePassed >= actualPetInfo.sleepTimeLoss * 60 && actualPetInfo.energyLvl >= 0)
            {
                actualPetInfo.energyLvl--;
                sleepTimePassed = 0;
                actualPetInfo.UpdateVisuals(actualPetInfo.energyLvl, actualPetInfo.pointsLists.sleepPoints);
                actualPetInfo.ChangeMaterial(3);
                ShakeCam();
                StartCoroutine(resetMat());
            }

            if (dayTimePassed >= actualPetInfo.dayTimeMin * 60)
            {
                dayCount++;
                dayTimePassed = 0;
                roomLogic.UpdateDayCount(dayCount);
                shopLogic.IncreaseEconomy(dayCount * 100);
                shopLogic.totalDays++;
            }
            CheckHp();
        }
    }