No, but I can give u full version of me code, for reproduce that: http://www.filedropper.com/lessmess
In this arhive have a next files, it’s full version:
Main.as
Scene@ scene_;
void Start()
{
log.Open("log.txt");
scene_ = Scene();
scene_.LoadXML(cache.GetFile("Scenes/Level01.xml"));
renderer.viewports[0] = Viewport(scene_, scene_.GetChild("PlayerCamera").GetComponent("Camera"));
SubscribeToEvent("innerEvent", "HandleInnerEvent");
}
void HandleInnerEvent(StringHash eventType, VariantMap& eventData)
{
log.Info("--- send recive ---");
scene_.RemoveAllChildren();
}
ProxyNode.as
class ProxyNode : ScriptObject
{
String sourceXML;
void DelayedStart()
{
XMLFile@ xmlfile = cache.GetResource("XMLFile", sourceXML);
Node@ newNode = scene.CreateChild();
newNode.LoadXML(xmlfile.GetRoot(), true);
newNode.SetTransform(node.position, node.rotation);
}
}
PlayerVehicle
class PlayerVehicle : ScriptObject
{
String selfGRightNode;
private float timeAccamulate;
private bool isSendDone;
void DelayedStart()
{
ConstraintRevolute2D@ constraint = node.CreateComponent("ConstraintRevolute2D");
constraint.otherBody = node.GetChild(selfGRightNode).GetComponent("RigidBody2D");
}
void FixedUpdate(float timeStep)
{
timeAccamulate += timeStep;
if ( timeAccamulate > 2.0f and !isSendDone )
{
isSendDone = true;
VariantMap vmap;
SendEvent("innerEvent", vmap);
}
}
}
And *.xml you can see in arhive, if it need.