Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
This exemple not working. I try to implement a BOT engine in C# to understand what are good points and negative points. http://www.chris-granger.com/2012/12/11/anatomy-of-a-knockout/
Class Element : BotObject
{
Behavior={":black", ":next_click_white"}
}
class BlackBehavior
{
Trigger = {":click"},
Reaction( (o) => {
System.WriteLine("Noir")
})
}
class WhiteBehavior() {
Trigger = {":click"},
Reaction( (o) => {
System.WriteLine("Blanc")
})
}
class NextClickWhiteBehavior() {
Trigger = {":click"},
Reaction( (o) => {
o.RemoveBehavior(":black");
o.AddBehavior(":white");
o.RemoveBehavior(":next_click_white");
o.AddBehavior(":next_click_black");
})
}
class NextClickBlackBehavior() {
Trigger = {":click"},
Reaction( (o) => {
o.RemoveBehavior(":black");
o.AddBehavior(":white");
o.RemoveBehavior(":next_click_black");
o.AddBehavior(":next_click_white");
})
}
Behaviors behaviors = new Behaviors()
{
{":black", new BlackBehavior()},
{":white", new WhiteBehavior()},
{":next_click_white", new NextClickWhiteBehavior()},
{":next_click_black", new NextClickBlackBehavior()}
}
Component component = new BotObject()
{
Id=":app",
Components = new List<BotObject>() {
new BotObject() {
Id=":elt",
Trigger={":click"},
Behavior={":black", ":next_click_white"}
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.