General purpose implementation of behaviour trees for use in Unity3D