Пример #1
0
    public void WearPers()
    {
        ClothLoader cloth = player.GetComponentInChildren <ClothLoader>();

        for (int i = 0; i < clothData.Length; i++)
        {
            cloth.Wear(clothData[i]);
        }
    }
Пример #2
0
    public void WearPers()
    {
        ClothLoader cloth = characters[StatePoint - 1].GetComponentInChildren <ClothLoader>();

        cloth.TakeOff();
        for (int i = 0; i < clothData[StatePoint - 1].Length; i++)
        {
            cloth.Wear(clothData[StatePoint - 1][i]);
        }
        PriceLabel.alpha  = 0;
        PriceLabel1.alpha = 0;
    }
Пример #3
0
    void Buy()
    {
        ClothLoader cloth = characters[StatePoint - 1].GetComponentInChildren <ClothLoader>();

        if (openedCloth[StatePoint - 1][cloth.getIndex(clothName)] || clothName == "none")
        {
            BuyLabel.text = "Применено";
            clothData[StatePoint - 1][cloth.DetermineTypeIndex(clothName)] = clothName;

            if (clothName == "none")
            {
                cloth.TakeOff();
                for (int i = 0; i < 4; i++)
                {
                    clothData[StatePoint - 1][i] = "none";
                }
            }
            else
            {
                cloth.Wear(clothName);
            }
        }
        else
        {
            int price = cloth.getPrice(clothName);
            if (getMoney() >= price)
            {
                changeMoney(-price, true);

                clothData[StatePoint - 1][cloth.DetermineTypeIndex(clothName)] = clothName;

                BuyLabel.text = "Применено";
                openedCloth[StatePoint - 1][cloth.getIndex(clothName)] = true;
            }
            else
            {
                BuyLabel.text = "Не хватает бабосов!!!";
            }
        }
    }
Пример #4
0
    void Update()
    {
        if (!audio.isPlaying)
        {
            audio.clip = villageSound;
            audio.Play();
        }

        if (StatePoint == 2)
        {
            transform.position = Vector3.SmoothDamp(transform.position, ball.position, ref velocity, 0.5f);

            if (transform.rotation.eulerAngles.y > 310)
            {
                transform.Rotate(new Vector3(0, -20 * Time.deltaTime, 0));
            }
        }
        else if (StatePoint == 1)
        {
            transform.position = Vector3.SmoothDamp(transform.position, rabbit.position, ref velocity, 0.5f);

            if (transform.rotation.eulerAngles.y > 310)
            {
                transform.Rotate(new Vector3(0, -20 * Time.deltaTime, 0));
            }
        }
        else if (StatePoint == 3)
        {
            transform.position = Vector3.SmoothDamp(transform.position, gera.position, ref velocity, 0.5f);

            if (transform.rotation.eulerAngles.y < 359)
            {
                transform.Rotate(new Vector3(0, 20 * Time.deltaTime, 0));
            }
        }
        else if (StatePoint == 4)
        {
            transform.position = Vector3.SmoothDamp(transform.position, kuritsa.position, ref velocity, 0.5f);

            if (transform.rotation.eulerAngles.y < 359)
            {
                transform.Rotate(new Vector3(0, 20 * Time.deltaTime, 0));
            }
        }
        else if (StatePoint == 5)
        {
            transform.position = Vector3.SmoothDamp(transform.position, dog.position, ref velocity, 0.5f);

            if (transform.rotation.eulerAngles.y > 310)
            {
                transform.Rotate(new Vector3(0, -20 * Time.deltaTime, 0));
            }
        }
        else if (StatePoint == 6)
        {
            transform.position = Vector3.SmoothDamp(transform.position, bear.position, ref velocity, 0.5f);

            if (transform.rotation.eulerAngles.y > 310)
            {
                transform.Rotate(new Vector3(0, -20 * Time.deltaTime, 0));
            }
        }
        else if (StatePoint == 7)
        {
            transform.position = Vector3.SmoothDamp(transform.position, koza.position, ref velocity, 0.5f);

            if (transform.rotation.eulerAngles.y > 310)
            {
                transform.Rotate(new Vector3(0, -20 * Time.deltaTime, 0));
            }
        }

        if (gridSelecion.centeredObject)
        {
            if (gridSelecion.centeredObject.name != clothName)
            {
                clothName = gridSelecion.centeredObject.name;
                ClothLoader cloth = characters[StatePoint - 1].GetComponentInChildren <ClothLoader>();

                //clothData[StatePoint - 1][cloth.DetermineType(clothName)] = clothName;
                if (openedCloth[StatePoint - 1][cloth.getIndex(clothName)] || clothName == "none")
                {
                    if (clothData[StatePoint - 1][cloth.DetermineTypeIndex(clothName)] == clothName)
                    {
                        BuyLabel.text = "Применено";
                    }
                    else
                    {
                        BuyLabel.text = "Применить";
                    }

                    PriceLabel.alpha  = 0;
                    PriceLabel1.alpha = 0;
                }
                else
                {
                    BuyLabel.text = "Купить";

                    PriceLabel.text   = cloth.getPrice(clothName).ToString();
                    PriceLabel.alpha  = 1;
                    PriceLabel1.alpha = 1;
                }

                if (clothName == "none")
                {
                    WearPers();
                }
                else
                {
                    cloth.Wear(clothName);
                }
            }
        }

        if (Input.GetKey(KeyCode.Escape))
        {
#if UNITY_ANDROID
            if (!Payed())
            {
                if (tapjoy.enabled)
                {
                    tapjoy.ShowOnPausePlacement();
                }
            }
#endif
            Application.Quit();
        }
    }