Tower Activation Event

Subscribing

This event expects a void Method(ITower tower) Since it uses an ITower, it's fairly read-only.

Calling

This events has a few parameters you can supply in Call(). There are important differences between them, so read carefully. Note: It will not be called if the supplied tower isn't activated.

Call with ITower

Note: We don't generally recommend this. You can call the event by supplying an implementation of ITower. This assumes that the Activator is already set. We only recommend this if you've chosen to base your Application's Tower class to implement ITower.

Hint: The benefit of this method is that you're not giving direct access to your own Tower class, if thats what you want.

You can call the event by supplying an APITower and an APIActivator. There are many ways to do this, but you'll likely use the following:

TowerActivationEvent.Call(new APITower("Lyoko","ice",1),APIActivator.XANA)

Or, if you want to do it 'the hard way', you could also do:

APITower tower = new APITower("Lyoko,ice,1")
TowerActivationEvent.Call(tower,APIActivator.XANA);

But in that case, you might as well use ITower as an argument.

This approach is almost identical to:

Call with Strings

You can also call the event with only strings. Just like before, you won't be giving any access to your own tower class this way.

TowerActivationEvent.Call("lyoko","ice",1,"XANA");

This will throw an exception if the activator is invalid, so make sure to get it right, or to put it in a try/catch.

Last updated