N.I.R.E.X's user avatar
N.I.R.E.X's user avatar
N.I.R.E.X's user avatar
N.I.R.E.X
  • Member for 9 years, 11 months
  • Last seen this week
  • /
Stats
378
reputation
26k
reached
2
answers
3
questions
Loading…
About

There is not much about me... My whole life is based on one snippet of code!

namespace MyLife
{
    private class Day
    {
        public Coffee myGlass = new Coffee();
        public Day()
        {
            myGlass.OnSip += myGlass_OnSip;
            myGlass.OnEnd += myGlass_OnEnd;
            while(true)
            {
                myGlass.sip();
            }
        }

        void myGlass_OnSip(object sender, CoffeeArgs e)
        {
            Me.Relax();
            Me.Sigh();
        }

        void myGlass_OnEnd(object sender, CoffeeArgs e)
        {
            myGlass.refill();
        }
    }

    public class Coffee
    {
        public delegate void drink(object sender, CoffeeArgs e);
        public event drink OnSip;
        public event drink OnEnd;

        public float amount;

        public void refill()
        {
            this.amount = 100;
        }

        public void sip()
        {
            if (amount > 0)
            {
                this.amount--;
                CoffeeArgs coffeeArgs = new CoffeeArgs(this.amount);
                OnSip(this, coffeeArgs);
            }
            else
            {
                CoffeeArgs coffeeArgs = new CoffeeArgs(this.amount);
                OnEnd(this, coffeeArgs);
            }
        }
    }
}
1
gold badge
3
silver badges
14
bronze badges
2
Score
4
Posts
80
Posts %
2
Score
1
Posts
20
Posts %
2
Score
1
Posts
20
Posts %
2
Score
1
Posts
20
Posts %
1
Score
1
Posts
20
Posts %
1
Score
1
Posts
20
Posts %
Top posts