Experimenting with AngryAnt’s Behave add-on to see if it can be used with JavaScript. As mentioned in the documentation for Behave, to make use of the the script you need to make a class which extends “BehaveLibrary.IAgent”. No problem there, just start with:
#pragma strict
class SomeClass extends BehaveLibrary.IAgent {
.....
However, doing this loses the connection with all those MonoBehaviour goodies, such as yield, destroy, etc. Not to mention all sorts of basic Unity stuff, too.
The question, then, is can a JavaScript class in Unity extend multiple classes? Normal JavaScript should be able to accept:
class SomeClass extends MonoBehaviour, BehaveLibary.IAgent {
However, this generates errors:
Does anybody know if multiple inheritance is supported in UnityScript, and if so what the syntax is?
you can not extend multiple classes, thats not possible independent of the language.
You can extend a single class + abstract classes (“interfaces”) only and that is potentially restricted to C# actually as UnityScript is geared towards simplicity, not feature completeness.
Also you don’t need it actually.
You wouldn’t want the agent to be a monobehaviour, you would want the agent to store a game object reference, the game object which is driven by its behaviour to be precise.