public ReplayWindow(Track track) : base("Replay Track: " + track.TrackName)
{
bool loadCraft = true;
if (loadCraft)
{
try
{
ghost = CraftLoader.assembleCraft(Utilities.CraftPath + track.VesselName + ".crf", track.ReplayColliders); // --- add the craft file listed in the path, or selected from a menu ---
}
catch
{
//Debug.Log("ERROR LOADING CRF, FALLING BACK TO SPHERE");
loadCraft = false;
}
}
if (!loadCraft)
{
Mesh sphere = MeshFactory.createSphere();
ghost = MeshFactory.makeMeshGameObject(ref sphere, "Track playback sphere");
ghost.transform.localScale = new Vector3(track.ConeRadiusToLineWidthFactor * track.LineWidth, track.ConeRadiusToLineWidthFactor * track.LineWidth, track.ConeRadiusToLineWidthFactor * track.LineWidth);
//ghost.collider.enabled = false;
ghost.GetComponent <Renderer>().material = new Material(Shader.Find("KSP/Emissive/Diffuse"));
ghost.GetComponent <Renderer>().material.SetColor("_EmissiveColor", track.LineColor);
}
behaviour = ghost.AddComponent <ReplayBehaviour>();
behaviour.initialize(track, ghost);
behaviour.enabled = true;
this.windowPos = new Rect(600f, 50f, 300f, 100f);
}