When I define my event inside a class I know what the parameters will be. My question is, in C#, can different class functions that get bound to this event either not define any parameters or define them as a dynamic type so that things act more like a scripted language (say Lua).
pseudo code to show the idea.
class Input
{
MyEvent<int, int> onKeyDown;
public void Update()
{
if(KeyHit())
onKeyDown.Raise(key, ctrl);
}
}
class Controller
{
// notice how we don't care about the parameters the event is sending so we don't define anything. this is what I'm curious if it can happen
public void Move()
{
}
}
Input input = new Input()
Controller c = new Controller()
input.onKeyDown += controller.Move
What would be the closest thing you can get to having this work?
Or maybe I only care about the key and not the ctrl so I define Move() with only the first parameter?