예제 #1
0
    // Update is called once per frame
    void Update()
    {
        if (_CarSelectionGridInt == 0)
        {
            Cata.SetActiveRecursively(true);
            F599.SetActiveRecursively(false);
            FCa.SetActiveRecursively(false);
            Lambo.SetActiveRecursively(false);
            Lotus.SetActiveRecursively(false);
            _target = CataMass;
        }

        if (_CarSelectionGridInt == 1)
        {
            Cata.SetActiveRecursively(false);
            F599.SetActiveRecursively(false);
            FCa.SetActiveRecursively(false);
            Lambo.SetActiveRecursively(false);
            Lotus.SetActiveRecursively(true);
        }
        if (_CarSelectionGridInt == 2)
        {
            Cata.SetActiveRecursively(false);
            F599.SetActiveRecursively(false);
            FCa.SetActiveRecursively(false);
            Lambo.SetActiveRecursively(true);
            Lotus.SetActiveRecursively(false);
        }
        if (_CarSelectionGridInt == 3)
        {
            Cata.SetActiveRecursively(false);
            F599.SetActiveRecursively(false);
            FCa.SetActiveRecursively(true);
            Lambo.SetActiveRecursively(false);
            Lotus.SetActiveRecursively(false);
        }
        if (_CarSelectionGridInt == 4)
        {
            Cata.SetActiveRecursively(false);
            F599.SetActiveRecursively(true);
            FCa.SetActiveRecursively(false);
            Lambo.SetActiveRecursively(false);
            Lotus.SetActiveRecursively(false);
        }
    }
    void OnGUI()
    {
        GUI.BeginGroup(new Rect(Screen.width - buttonWidth * 2 - 130 - buttonSpacing * 40, buttonSpacing, buttonWidth + buttonSpacing * 160, buttonHeight / 3 - buttonSpacing * 4));
        GUI.Box(new Rect(0, 0, buttonWidth * 2 - 135 + buttonSpacing * 2, buttonHeight / 6 + 18 + buttonSpacing * 5), "");
        CarSelectionGridInt = GUI.SelectionGrid(new Rect(buttonSpacing, buttonSpacing, buttonWidth * 2, buttonHeight / 4), CarSelectionGridInt, ThumbnailsLocked, 6);
        GUI.EndGroup();


/*
 * If selected car is bought you can see filled info box and car itself
 */
        if (xmlReaderRights.lotusStatus_ != 0)
        {
            ThumbnailsLocked[1] = LotusLogo;

            if (CarSelectionGridInt == 1)
            {
                Cata.SetActiveRecursively(false);
                F599.SetActiveRecursively(false);
                FCa.SetActiveRecursively(false);
                Lambo.SetActiveRecursively(false);
                Lotus.SetActiveRecursively(true);

                GUI.Box(new Rect(0, 0, Screen.width - 1150, Screen.height - 400), "Lotus Evora");
                GUI.Box(new Rect(0, 20, Screen.width - 1150, Screen.height - 400), LotusCarInfo);

                CarSelectionGridInt = 1;
            }
        }

        if (xmlReaderRights.lamboStatus_ != 0)
        {
            ThumbnailsLocked[2] = LamborghiniLogo;

            if (CarSelectionGridInt == 2)
            {
                Cata.SetActiveRecursively(false);
                F599.SetActiveRecursively(false);
                FCa.SetActiveRecursively(false);
                Lambo.SetActiveRecursively(true);
                Lotus.SetActiveRecursively(false);

                GUI.Box(new Rect(0, 0, Screen.width - 1150, Screen.height - 400), "Lamborghini Murcielago");
                GUI.Box(new Rect(0, 20, Screen.width - 1150, Screen.height - 400), LamboCarInfo);
            }
        }

        if (xmlReaderRights.fCaStatus_ != 0)
        {
            ThumbnailsLocked[3] = FerrariCALogo;

            if (CarSelectionGridInt == 3)
            {
                Cata.SetActiveRecursively(false);
                F599.SetActiveRecursively(false);
                FCa.SetActiveRecursively(true);
                Lambo.SetActiveRecursively(false);
                Lotus.SetActiveRecursively(false);

                GUI.Box(new Rect(0, 0, Screen.width - 1150, Screen.height - 400), "Ferrari California");
                GUI.Box(new Rect(0, 20, Screen.width - 1150, Screen.height - 400), FCaCarInfo);
            }
        }

        if (xmlReaderRights.f599Status_ != 0)
        {
            ThumbnailsLocked[4] = Ferrari599Logo;

            if (CarSelectionGridInt == 4)
            {
                Cata.SetActiveRecursively(false);
                F599.SetActiveRecursively(true);
                FCa.SetActiveRecursively(false);
                Lambo.SetActiveRecursively(false);
                Lotus.SetActiveRecursively(false);

                GUI.Box(new Rect(0, 0, Screen.width - 1150, Screen.height - 400), "Ferrari 599");
                GUI.Box(new Rect(0, 20, Screen.width - 1150, Screen.height - 400), F599CarInfo);
            }
        }

/*
 * Shows Price tag for every car that is not bought
 */
        if (xmlReaderRights.lotusStatus_ == 0)            // for Lotus
        {
            if (CarSelectionGridInt == 1)
            {
                GUI.Box(new Rect(0, 0, Screen.width - 1150, Screen.height - 400), "Lotus Evora");
                GUI.Box(new Rect(0, 20, Screen.width - 1150, Screen.height - 400), lotusPrice + " \n Your money $" + money);
            }
        }

        if (xmlReaderRights.lamboStatus_ == 0)   //for Lambo
        {
            if (CarSelectionGridInt == 2)
            {
                GUI.Box(new Rect(0, 0, Screen.width - 1150, Screen.height - 400), "Lamborghini Murcielago");
                GUI.Box(new Rect(0, 20, Screen.width - 1150, Screen.height - 400), lamboPrice + " \n Your money $" + money);
            }
        }
        if (xmlReaderRights.fCaStatus_ == 0)                     //for Ferrari CA
        {
            if (CarSelectionGridInt == 3)
            {
                GUI.Box(new Rect(0, 0, Screen.width - 1150, Screen.height - 400), "Ferrari California");
                GUI.Box(new Rect(0, 20, Screen.width - 1150, Screen.height - 400), fCaPrice + " \n Your money $" + money);
            }
        }
        if (xmlReaderRights.f599Status_ == 0)            //for Ferrari 599
        {
            if (CarSelectionGridInt == 4)
            {
                GUI.Box(new Rect(0, 0, Screen.width - 1150, Screen.height - 400), "Ferrari F599");
                GUI.Box(new Rect(0, 20, Screen.width - 1150, Screen.height - 400), f599Price + " \n Your money $" + money);
            }
        }

/*
 * Unity car is always active!
 */
        if (CarSelectionGridInt == 0)
        {
            Cata.SetActiveRecursively(true);
            F599.SetActiveRecursively(false);
            FCa.SetActiveRecursively(false);
            Lambo.SetActiveRecursively(false);
            Lotus.SetActiveRecursively(false);

            CarSelectionGridInt = 0;
            GUI.Box(new Rect(0, 0, Screen.width - 1150, Screen.height - 400), "Unit One");
            GUI.Box(new Rect(0, 20, Screen.width - 1150, Screen.height - 400), UnityCarInfo);
        }

        if (GUI.Button(new Rect(0, Screen.height - 50, 100, 50), "Back")) // Brings you back to the Main Menu

        {
            Application.LoadLevel("Menu");
        }

        xmlReaderRights reader = new xmlReaderRights();

        reader.Start();
    }
예제 #3
0
    // Update is called once per frame
    void Update()
    {
        if (_CarSelectionGridInt == 0)
        {
            Cata.SetActiveRecursively(true);
            F599.SetActiveRecursively(false);
            FCa.SetActiveRecursively(false);
            Lambo.SetActiveRecursively(false);
            Lotus.SetActiveRecursively(false);

            if (CataColorChange.ColorsSelectionGridInt == 0)
            {
                body.renderer.material.mainTexture = red;
            }

            if (CataColorChange.ColorsSelectionGridInt == 1)
            {
                body.renderer.material.mainTexture = blue;
            }
            if (CataColorChange.ColorsSelectionGridInt == 2)
            {
                body.renderer.material.mainTexture = yellow;
            }
            if (CataColorChange.ColorsSelectionGridInt == 3)
            {
                body.renderer.material.mainTexture = pink;
            }
            if (CataColorChange.ColorsSelectionGridInt == 4)
            {
                body.renderer.material.mainTexture = green;
            }
            if (CataColorChange.ColorsSelectionGridInt == 5)
            {
                body.renderer.material.mainTexture = orange;
            }


            _target = CataMass;
        }

        if (_CarSelectionGridInt == 1)
        {
            Cata.SetActiveRecursively(false);
            Lotus.SetActiveRecursively(true);
            F599.SetActiveRecursively(false);
            FCa.SetActiveRecursively(false);
            Lambo.SetActiveRecursively(false);

            lotusBlack.active  = false;
            lotusRed.active    = false;
            lotusYellow.active = false;
            lotusGreen.active  = false;
            lotusSilver.active = false;
            lotusBlue.active   = false;


            if (selectedColorInt == 0)
            {
                lotusBlack.SetActiveRecursively(true);
            }

            if (selectedColorInt == 1)
            {
                lotusRed.SetActiveRecursively(true);
            }
            if (selectedColorInt == 2)
            {
                lotusYellow.SetActiveRecursively(true);
            }
            if (selectedColorInt == 3)
            {
                lotusGreen.SetActiveRecursively(true);
            }
            if (selectedColorInt == 4)
            {
                lotusSilver.SetActiveRecursively(true);
            }
            if (selectedColorInt == 5)
            {
                lotusBlue.SetActiveRecursively(true);
            }
        }
        if (_CarSelectionGridInt == 2)
        {
            Cata.SetActiveRecursively(false);
            F599.SetActiveRecursively(false);
            Lambo.SetActiveRecursively(true);
            FCa.SetActiveRecursively(false);
            Lotus.SetActiveRecursively(false);

            lamboRed.active    = false;
            lamboOrange.active = false;
            lamboYellow.active = false;
            lamboBlue.active   = false;
            lamboBlack.active  = false;
            lamboGreen.active  = false;

            if (selectedColorInt == 0)
            {
                lamboBlack.SetActiveRecursively(true);
            }
            if (selectedColorInt == 1)
            {
                lamboRed.SetActiveRecursively(true);
            }
            if (selectedColorInt == 2)
            {
                lamboYellow.SetActiveRecursively(true);
            }
            if (selectedColorInt == 3)
            {
                lamboGreen.SetActiveRecursively(true);
            }
            if (selectedColorInt == 4)
            {
                lamboOrange.SetActiveRecursively(true);
                lamboOrange.active = true;
            }
            if (selectedColorInt == 5)
            {
                lamboBlue.SetActiveRecursively(true);
            }
        }
        if (_CarSelectionGridInt == 3)
        {
            Cata.SetActiveRecursively(false);
            F599.SetActiveRecursively(false);
            FCa.SetActiveRecursively(true);
            Lambo.SetActiveRecursively(false);
            Lotus.SetActiveRecursively(false);

            fCaBlack.active  = false;
            fCaBlue.active   = false;
            fCaYellow.active = false;
            fCaRed.active    = false;
            fCaSilver.active = false;
            fCaGreen.active  = false;

            if (selectedColorInt == 0)
            {
                fCaBlack.SetActiveRecursively(true);
            }
            if (selectedColorInt == 1)
            {
                fCaRed.SetActiveRecursively(true);
            }
            if (selectedColorInt == 2)
            {
                fCaYellow.SetActiveRecursively(true);
            }
            if (selectedColorInt == 3)
            {
                fCaGreen.SetActiveRecursively(true);
            }
            if (selectedColorInt == 4)
            {
                fCaSilver.SetActiveRecursively(true);
            }
            if (selectedColorInt == 5)
            {
                fCaBlue.SetActiveRecursively(true);
            }
        }
        if (_CarSelectionGridInt == 4)
        {
            Cata.SetActiveRecursively(false);
            F599.SetActiveRecursively(true);
            FCa.SetActiveRecursively(false);
            Lambo.SetActiveRecursively(false);
            Lotus.SetActiveRecursively(false);

            f599Black.active  = false;
            f599Blue.active   = false;
            f599Red.active    = false;
            f599White.active  = false;
            f599Yellow.active = false;
            f599Silver.active = false;

            if (selectedColorInt == 0)
            {
                f599Black.SetActiveRecursively(true);
            }
            if (selectedColorInt == 1)
            {
                f599Red.SetActiveRecursively(true);
            }
            if (selectedColorInt == 2)
            {
                f599Yellow.SetActiveRecursively(true);
            }
            if (selectedColorInt == 3)
            {
                f599White.SetActiveRecursively(true);
            }
            if (selectedColorInt == 4)
            {
                f599Silver.SetActiveRecursively(true);
            }
            if (selectedColorInt == 5)
            {
                f599Blue.SetActiveRecursively(true);
            }
        }
    }