Game Development Reference
In-Depth Information
{
ActionsToDo += DoJob3;
}
}
//With Update, do the actions set on ActionsToDo
void Update()
{
ActionsToDo();
}
private void DoJob1()
{
//Do some filing
}
private void DoJob2()
{
//Make coffee for the office
}
private void DoJob3()
{
//Play Golf
}
}
This also means it's dynamic and you can add additional functions to the delegate that will
be called whenever the delegate is called.
Tip
Word to the wise: only use chained delegates when you absolutely need the flexibility to
do so as they are a more complex pattern to implement. They are also difficult to debug
should something untoward happen.
Search WWH ::




Custom Search