Example #1
0
    void OnGUI()
    {
        //promils


        string message = "Alcohol level: " + Drinker.CalculatePromils().ToString() + "‰";

        GUI.Label(new Rect(10, 10, 100, 20), "Alcohol level: ");
        GUI.Label(new Rect(10, 25, 100, 20), Drinker.CalculatePromils().ToString() + "‰");
        GUI.Label(new Rect(10, 40, 100, 20), "Sober by: ");
        GUI.Label(new Rect(10, 55, 100, 20), Drinker.soberingTime.Hour.ToString() + ":" + Drinker.soberingTime.Minute.ToString());
        GUI.Label(new Rect(10, 70, 100, 20), Drinker.soberingTime.Day.ToString() + "." + Drinker.soberingTime.Month.ToString() + "." + Drinker.soberingTime.Year.ToString());


        //Alcohol MENU
        if (GUI.Button(new Rect(3 * BREAKEWIDTH + 2 * BUTTONWIDTH, 0.575f * Screen.height, BUTTONWIDTH, BUTTONHEIGHT), amountTextures[0]))
        {
            print("asds");
            Drinker.Drink(alcoholMass);
        }

        if (GUI.Button(new Rect(BREAKEWIDTH, 0.85f * Screen.height, 3 * BUTTONWIDTH + 2 * BREAKEWIDTH, BUTTONHEIGHT / 2), amountTextures[1]))
        {
            Application.LoadLevel("AlcoholSelect");
        }
    }
Example #2
0
    void OnGUI()
    {
        //variable about kind of amount texture
        int textureCategory;

        if (alcoholSelected == 0)
        {
            textureCategory = 0;
            amount          = 0;
        }
        else if (alcoholSelected == 1 || alcoholSelected == 2)
        {
            textureCategory = 1;
            amount          = 1;
        }
        else
        {
            textureCategory = 2;
            amount          = 2;
        }


        //Alcohol selection
        if (GUI.Button(new Rect(BREAKEWIDTH, BREAKEHEIGHT, BUTTONWIDTH, BUTTONHEIGHT), amountTextures[textureCategory * 3]))
        {
            ///Calculating mass of alkohol
            alcoholMass = 0.798f * shot.Amount[0] * (shot.Power / 100);

            print(Drinker.Drink(alcoholMass));
            print(textureCategory * 3);
            Stats.alcoholMass = alcoholMass;
            Application.LoadLevel("Stats");
        }


        if (GUI.Button(new Rect(2 * BREAKEWIDTH + BUTTONWIDTH, BREAKEHEIGHT, BUTTONWIDTH, BUTTONHEIGHT), amountTextures[textureCategory * 3 + 1]))
        {
            alcoholMass = 0.798f * shot.Amount[1] * (shot.Power / 100);
            print(Drinker.Drink(alcoholMass));
            Stats.alcoholMass = alcoholMass;
            Application.LoadLevel("Stats");
        }
        if (GUI.Button(new Rect(3 * BREAKEWIDTH + 2 * BUTTONWIDTH, BREAKEHEIGHT, BUTTONWIDTH, BUTTONHEIGHT), amountTextures[textureCategory * 3 + 2]))

        {
            alcoholMass = 0.798f * shot.Amount[2] * (shot.Power / 100);
            print(Drinker.Drink(alcoholMass));
            Stats.alcoholMass = alcoholMass;
            Application.LoadLevel("Stats");
        }
        if (GUI.Button(new Rect(BREAKEWIDTH, 3 * BREAKEHEIGHT + 2 * BUTTONHEIGHT, 3 * BUTTONWIDTH + 2 * BREAKEWIDTH, BUTTONHEIGHT / 2), "Back"))
        {
            Application.LoadLevel("Stats");
        }
    }
    public static void Main(string[] args)
    {
        Barman    barman    = new Barman();
        Drinker   drinker   = new Drinker(barman);
        Stopwatch stopwatch = Stopwatch.StartNew();

        drinker.Drink();
        stopwatch.Stop();
        Console.WriteLine($"Took {stopwatch.ElapsedMilliseconds}");
        Console.ReadLine();
    }
Example #4
0
 void OnGUI()
 {
     //Alcohol selection
     if (GUI.Button(new Rect(BREAKEWIDTH, BREAKEHEIGHT, BUTTONWIDTH, BUTTONHEIGHT), "small"))
     {
         ///Calculating mass of alkohol
         alcoholMass = 0.798f * shot.Amount[0] * (shot.Power / 100);
         print(Drinker.Drink(alcoholMass));
     }
     if (GUI.Button(new Rect(2 * BREAKEWIDTH + BUTTONWIDTH, BREAKEHEIGHT, BUTTONWIDTH, BUTTONHEIGHT), "medium"))
     {
         alcoholMass = 0.798f * shot.Amount[1] * (shot.Power / 100);
         print(Drinker.Drink(alcoholMass));
     }
     if (GUI.Button(new Rect(3 * BREAKEWIDTH + 2 * BUTTONWIDTH, BREAKEHEIGHT, BUTTONWIDTH, BUTTONHEIGHT), "high"))
     {
         alcoholMass = 0.798f * shot.Amount[2] * (shot.Power / 100);
         print(Drinker.Drink(alcoholMass));
     }
     if (GUI.Button(new Rect(BREAKEWIDTH, 3 * BREAKEHEIGHT + 2 * BUTTONHEIGHT, 3 * BUTTONWIDTH + 2 * BREAKEWIDTH, BUTTONHEIGHT / 2), "Back"))
     {
         Application.LoadLevel("AlcoholSelect");
     }
 }