コード例 #1
0
ファイル: Stats.cs プロジェクト: DanteX95X/AlcoAdventure
    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");
        }
    }
コード例 #2
0
ファイル: RideTheBusGame.cs プロジェクト: zachcdr/BlazorGames
        private bool PlayRedOrBlack(string choice, Drinker player)
        {
            var correct = false;

            switch (player.Cards[0].Suit)
            {
            case Suit.Diamond:
            case Suit.Heart:
                if (choice == "Red")
                {
                    correct = true;
                }
                break;

            case Suit.Spade:
            case Suit.Club:
                if (choice == "Black")
                {
                    correct = true;
                }
                break;
            }

            return(correct);
        }
コード例 #3
0
ファイル: RideTheBusGame.cs プロジェクト: zachcdr/BlazorGames
        private bool PlayInsideOrOutside(string choice, Drinker player)
        {
            var correct = false;

            var cards = new List <Card>()
            {
                player.Cards[0], player.Cards[1]
            }.OrderBy(c => c.Value).ToList();

            switch (choice)
            {
            case "Inside":
                if (cards[0].Value <player.Cards[2].Value && cards[1].Value> player.Cards[2].Value)
                {
                    correct = true;
                }
                break;

            case "Outside":
                if (cards[0].Value > player.Cards[2].Value || cards[1].Value < player.Cards[2].Value)
                {
                    correct = true;
                }
                break;
            }

            return(correct);
        }
コード例 #4
0
 // Use this for initialization
 void Start()
 {
     if (!Drinker.isInitialized)
     {
         print(Drinker.Initialize(75, 185, true, true));
     }
 }
コード例 #5
0
        public ActionResult DeleteConfirmed(int id)
        {
            Drinker drinker = db.Drinkers.Find(id);

            db.Drinkers.Remove(drinker);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #6
0
 // Use this for initialization
 void Start()
 {
     CreateShot();
     if (!Drinker.isInitialized)
     {
         print(Drinker.Initialize(75, 185, true, true));
     }
 }
コード例 #7
0
    // Update is called once per frame
    void Update()
    {
        string message = Drinker.UpdateStatus();

        if (message != "")
        {
            print(message);
        }
    }
コード例 #8
0
 public ActionResult Edit([Bind(Include = "DrinkerID,Alias,Gender,DrinkerImage")] Drinker drinker)
 {
     if (ModelState.IsValid)
     {
         db.Entry(drinker).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(drinker));
 }
コード例 #9
0
 public ActionResult Edit([Bind(Include = "DrinkerID,FName,LName,UserName,LocationState,LocationCity,FavoriteBeer,FavoriteBrewery,Age,NoOfTastings,ProfileCreated")] Drinker drinker)
 {
     if (ModelState.IsValid)
     {
         db.Entry(drinker).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(drinker));
 }
コード例 #10
0
    // Update is called once per frame
    void Update()
    {
        CheckResolution();
        string message = Drinker.UpdateStatus();

        if (message != "")
        {
            print(message);
        }
    }
コード例 #11
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");
        }
    }
コード例 #12
0
    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();
    }
コード例 #13
0
        public ActionResult Create([Bind(Include = "DrinkerID,Alias,Gender,DrinkerImage")] Drinker drinker)
        {
            if (ModelState.IsValid)
            {
                db.Drinkers.Add(drinker);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(drinker));
        }
コード例 #14
0
        // GET: Drinker/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Drinker drinker = db.Drinkers.Find(id);

            if (drinker == null)
            {
                return(HttpNotFound());
            }
            return(View(drinker));
        }
コード例 #15
0
    // Update is called once per frame
    void Update()
    {
        CheckResolution();
        string message = Drinker.UpdateStatus();

        if (message != "")
        {
            print(message);
        }

        if (Input.GetKeyDown(KeyCode.Escape))
        {
            Application.Quit();
        }
    }
コード例 #16
0
ファイル: RideTheBusGame.cs プロジェクト: zachcdr/BlazorGames
        public async Task Join(Player player)
        {
            Drinker drinker = (Drinker)player;

            if (Game.Players.Count == 0)
            {
                drinker.IsAdmin = true;
            }

            drinker.Id    = Game.Players.Count + 1;
            drinker.State = PlayerState.WaitingTurn;

            Game.Players.Add(drinker);

            await Save();
        }
コード例 #17
0
ファイル: Drinkable.cs プロジェクト: palpitatertot/poodles
    private void OnTriggerExit(Collider other)
    {
        TurnOffSound();

        if (!isServer)
        {
            Debug.Log("Leaved as Client");
            return;
        }
        Debug.Log("Leaved as Server");
        Drinker d = other.gameObject.transform.parent.gameObject.GetComponent <Drinker>();

        if (d != null)
        {
            Debug.Log("D Exists");
            inRange.Remove(d);
        }
        Debug.Log(inRange.Count);
    }
コード例 #18
0
ファイル: Drinkable.cs プロジェクト: palpitatertot/poodles
    private void OnTriggerEnter(Collider other)
    {
        if (!isServer)
        {
            Debug.Log("Entered as Client");
            return;
        }
        Debug.Log("Entered as Server");
        Drinker d = other.gameObject.transform.parent.gameObject.GetComponent <Drinker>();

        Debug.Log(other.gameObject.transform.parent.gameObject);
        Debug.Log(d);
        if (d != null)
        {
            Debug.Log("D Exists");
            inRange.Add(d);
        }
        Debug.Log(inRange.Count);
    }
コード例 #19
0
    void Start()
    {
        _frontPivot = transform.Find("frontPivot");
        _rearPivot  = transform.Find("rearPivot");
        FrontPeePoofs.transform.position = _frontPivot.transform.position;
        RearPeePoofs.transform.position  = _rearPivot.transform.position;
        _front          = GetComponent <Rigidbody>();
        _animator       = this.GetComponentInChildren <Animator>();
        _inputH         = GetComponent <InputHandler>();
        _sfx            = GetComponents <AudioSource>();
        _runStartVolume = _sfx [2].volume;
        d = GetComponent <Drinker>();

        if (isLocalPlayer)
        {
            _emitter = GetComponent <Splatter>();
            _emitter.SetEmitter(transform.Find("rearPivot"));
            _emitter.SetChannel(_splatChannel);
        }
    }
コード例 #20
0
    void OnGUI()
    {
        GUI.Label(new Rect(Screen.width / 5 * 2, Screen.height / 20 * 3, BUTTON_WIDTH, BUTTON_HEIGHT), "Name");
        myName = GUI.TextField(new Rect(Screen.width / 5 * 2, Screen.height / 10 * 2, BUTTON_WIDTH, BUTTON_HEIGHT), myName);

        GUI.Label(new Rect(Screen.width / 5 * 2, Screen.height / 20 * 7, BUTTON_WIDTH, BUTTON_HEIGHT), "Mass");
        mass = GUI.TextField(new Rect(Screen.width / 5 * 2, Screen.height / 10 * 4, BUTTON_WIDTH, BUTTON_HEIGHT), mass);
        mass = Regex.Replace(mass, @"[^0-9 ]", "");

        GUI.Label(new Rect(Screen.width / 5 * 2, Screen.height / 20 * 11, BUTTON_WIDTH, BUTTON_HEIGHT), "Height");
        height = GUI.TextField(new Rect(Screen.width / 5 * 2, Screen.height / 10 * 6, BUTTON_WIDTH, BUTTON_HEIGHT), height);
        height = Regex.Replace(height, @"[^0-9 ]", "");

        isMale = GUI.Toggle(new Rect(Screen.width / 5, Screen.height / 10 * 8, Screen.width / 4, Screen.height / 10), isMale, "Male/Female");

        isStomachEmpty = GUI.Toggle(new Rect(Screen.width / 5 * 3, Screen.height / 10 * 8, Screen.width / 3, Screen.height / 10), isStomachEmpty, "Have you eaten anything lately?");

        if (GUI.Button(new Rect(Screen.width / 5 * 2, Screen.height / 20 * 18, Screen.width / 5, Screen.height / 20), "Done"))
        {
            print(Drinker.Initialize(float.Parse(mass), float.Parse(height), isMale, isStomachEmpty, myName));
            Application.LoadLevel("AlcoholSelect");
        }
    }
コード例 #21
0
ファイル: RideTheBusGame.cs プロジェクト: zachcdr/BlazorGames
        private bool PlayHighOrLow(string choice, Drinker player)
        {
            var correct = false;

            switch (choice)
            {
            case "Higher":
                if (player.Cards[0].Value < player.Cards[1].Value)
                {
                    correct = true;
                }
                break;

            case "Lower":
                if (player.Cards[0].Value > player.Cards[1].Value)
                {
                    correct = true;
                }
                break;
            }

            return(correct);
        }
コード例 #22
0
 public bool ValidateSplat(Splat newSplat)
 {
     Debug.Log("Seeing if peeing?");
     foreach (Splatter s in splatters.Keys)
     {
         if (newSplat.channelMask != SplatChannel.MAN && s.channelMask == newSplat.channelMask)
         {
             Drinker d = s.gameObject.GetComponent <Drinker> ();
             Debug.Log("Found me to pee");
             if (!d.CanPee())
             {
                 Debug.Log("Can't pee");
                 return(false);
             }
             else
             {
                 Debug.Log("Peeing");
                 d.Pee();
             }
         }
         else if (newSplat.channelMask == SplatChannel.MAN && s.channelMask == newSplat.channelMask)
         {
             Grabber g = s.gameObject.GetComponent <Grabber> ();
             if (g.hasMop)
             {
                 Debug.Log("Man is splatting");
                 return(true);
             }
             else
             {
                 Debug.Log("Man is not splatting");
                 return(false);
             }
         }
     }
     return(true);
 }
コード例 #23
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");
     }
 }
コード例 #24
0
ファイル: RideTheBusGame.cs プロジェクト: zachcdr/BlazorGames
        private bool PlayNameTheSuit(string choice, Drinker player)
        {
            var suit = (Suit)Enum.Parse(typeof(Suit), choice);

            return(suit == player.Cards[3].Suit);
        }