Esempio n. 1
0
 public void stopRecording()
 {
     //if (activeTrack.EndAction == Track.EndActions.LOOP)
     if (activeTrack != null)
     {
         Vector3 startPos = Vector3.zero;
         Vector3 endPos = Vector3.zero;
         Vector3 vel = Vector3.zero;
         Quaternion rot = Quaternion.identity;
         activeTrack.evaluateAtTime(activeTrack.GetStartTime(), out startPos, out rot, out vel);
         activeTrack.evaluateAtTime(activeTrack.GetEndTime(), out endPos, out rot, out vel);
         activeTrack.LoopClosureTime = Vector3.Distance(startPos, endPos) / vel.magnitude;
     }
     activeTrack = null;
     recording = false;
 }
Esempio n. 2
0
        public void startNewTrack()
        {
            Debug.Log("Starting new Track");
            recording = true;

            //create new Track
            activeTrack = new Track(); //initializes with TrackName = activeVessel.Name

            CraftLoader.saveCraftToFile();

            activeTrack.TrackName = Utilities.makeUniqueTrackName(activeTrack.TrackName, ref allTracks, false);
            allTracks.Add(activeTrack);
            updateCurrentTrack();
        }
Esempio n. 3
0
        public void continueTrack(Track track)
        {
            Debug.Log("TrackManager continueTrack()");
            stopRecording();

            CraftLoader.saveCraftToFile();

            recording = true;
            track.SourceVessel = FlightGlobals.ActiveVessel;
            track.VesselName = track.SourceVessel.name;

            activeTrack = track;
            updateCurrentTrack();
        }
Esempio n. 4
0
        public void deleteTrack(ref Track track)
        {
            allTracks.Remove(track);

            track.Visible = false;
            Debug.Log("removing track");
            if (File.Exists(Utilities.TrackPath + track.TrackName + ".trk"))
            {
                Debug.Log("deleting track-file");
                File.Delete(Utilities.TrackPath + track.TrackName + ".trk");
            }

            if (track == activeTrack) {
                stopRecording();
                activeTrack = null;
            }
            track = null;
        }
Esempio n. 5
0
        private TrackManager()
        {
            activeTrack = null;
            recording = false;

            allTracks = new List<Track>();
            //this.behaviour = behaviour;

            GameEvents.onVesselDestroy.Add(delegate(Vessel v)
            {
                if (activeTrack != null && activeTrack.SourceVessel == v)
                    stopRecording();
            });
            GameEvents.onDominantBodyChange.Add(delegate(GameEvents.FromToAction<CelestialBody, CelestialBody> fromToAction) {
                stopRecording();
            });
            GameEvents.onFlightReady.Add(delegate() {
                restoreTracksFromFile();
            });

            GameEvents.onGameSceneLoadRequested.Add(delegate(GameScenes scene)
            {
                clearTracks();
            });
        }