Пример #1
0
        /// <summary>
        /// Create a selection model for a specific kerbal.
        /// </summary>
        /// <param name="eva"></param>
        private void CreateLine(OrXchaseContainer container)
        {
            if (selectionLines.ContainsKey(container.flightID))
            {
                return;
            }

            LineRenderer lineRenderer = new GameObject().AddComponent <LineRenderer>();

            lineRenderer.useWorldSpace = false;
            lineRenderer.material      = new Material(Shader.Find("Particles/Additive"));
            //lineRenderer.SetWidth(0.05f, 0.05f);
            //lineRenderer.SetColors(Color.green, Color.red);

            Renderer _renderer = null;

            lineRenderer.GetComponentCached <Renderer> (ref _renderer);

            if (_renderer != null)
            {
                _renderer.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off;
                _renderer.receiveShadows    = false;
            }

            int segments = 32;

            //lineRenderer.SetVertexCount(segments);

            CreateCircle(lineRenderer, segments, 0.25);

            //set properties
            SetSelectionLineProperties(container.EVA, lineRenderer);

            selectionLines.Add(container.flightID, lineRenderer);
        }
Пример #2
0
        public void Load(Vessel vessel)
        {
            if (!vessel.isEVA)
            {
                OrXchaseDebug.DebugWarning("Tried loading a non eva.");
                return;
            }

            KerbalEVA OrXEVA     = vessel.GetComponent <KerbalEVA>();
            var       currentEVA = vessel.FindPartModuleImplementing <KerbalEVA>();

            if (!Contains(vessel.id))
            {
                OrXchaseContainer container = new OrXchaseContainer(vessel.id);

                //load the vessel here.
                container.Load(currentEVA);
                OrXchaseSettings.LoadEva(container);

                collection.Add(container);
            }
            else
            {
                //Reload
                OrXchaseContainer container = GetEva(vessel.id);

                container.Load(currentEVA);
                OrXchaseSettings.LoadEva(container);
            }
        }
Пример #3
0
        public static void SaveEva(OrXchaseContainer container)
        {
            OrXchaseDebug.DebugWarning("OrXchaseSettings.SaveEva(" + container.Name + ")");

            if (container.status == Status.Removed)
            {
                if (collection.ContainsKey(container.flightID))
                {
                    collection.Remove(container.flightID);
                }
            }
            else
            {
                //The eva was already has a old save.
                if (collection.ContainsKey(container.flightID))
                {
                    //Replace the old save.
                    collection[container.flightID] = container.ToSave();
                }
                else
                {
                    //No save yet. Add it now.
                    collection.Add(container.flightID, container.ToSave());
                }
            }
        }
Пример #4
0
        /// <summary>
        /// Deselect an EVA, and remove the selection from the line collection.
        /// </summary>
        /// <param name="_eva"></param>
        private void DeselectEva(OrXchaseContainer _eva)
        {
            --selectedKerbals;
            _eva.Selected = false;

            //create circle line
            //DestroyLine(_eva.flightID);
        }
Пример #5
0
        public void Follow()
        {
            Guid flightID            = (FlightGlobals.fetch.activeVessel).id;
            OrXchaseContainer leader = OrXchaseController.instance.GetEva(flightID);

            selected = false;
            mode     = Mode.Follow;
            formation.SetLeader(leader);
        }
Пример #6
0
        /// <summary>
        /// Update the selection model position.
        /// </summary>
        /// <param name="eva"></param>
        public void UpdateSelectionLine(OrXchaseContainer container)
        {
            if (!selectionLines.ContainsKey(container.flightID))
            {
                CreateLine(container);
            }

            var lineRenderer = selectionLines[container.flightID];

            SetSelectionLineProperties(container.EVA, lineRenderer);
        }
Пример #7
0
        /// <summary>
        /// Select an EVA, and add the selection to the line collection.
        /// </summary>
        /// <param name="_eva"></param>
        private void SelectEva(OrXchaseContainer container)
        {
            if (!container.EVA.vessel.LandedOrSplashed)
            {
                return;
            }

            ++selectedKerbals;
            container.Selected = true;

            //create circle line
            //CreateLine(container);
        }
Пример #8
0
        public static void LoadEva(OrXchaseContainer container)
        {
            OrXchaseDebug.DebugWarning("OrXchaseSettings.LoadEva(" + container.Name + ")");

            //The eva was already has a old save.
            //Load it.
            if (collection.ContainsKey(container.flightID))
            {
                //string evaString = collection[container.flightID];
                //OrXchaseDebug.DebugWarning(evaString);

                container.FromSave(collection[container.flightID]);
            }
            else
            {
                //No save yet.
            }
        }
Пример #9
0
        public void FromSave(string formation)
        {
            try
            {
                //OrXchaseDebug.DebugWarning("Formation.FromSave()");
                formation = formation.Remove(0, 7); //Leader:

                if (formation != "null")
                {
                    Guid flightID = new Guid(formation);
                    OrXchaseContainer container = OrXchaseController.instance.GetEva(flightID);

                    if (container != null)
                    {
                        leader = container;
                    }
                }
            }
            catch
            {
                throw new Exception("[OrX Chase] Formation.FromSave Failed.");
            }
        }
Пример #10
0
 public void Load(OrXchaseContainer current)
 {
     this.currentContainer = current;
 }
Пример #11
0
 public void SetLeader(OrXchaseContainer leader)
 {
     this.leader = leader;
 }