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);
}
}
}
}