Inheritance: Waypoint
コード例 #1
0
ファイル: Track.cs プロジェクト: GrJo/KSPPersistentTrails
        private void setupLogEntryLabel(LogEntry logEntry)
        {
            if (logEntry.gameObject == null)
            {
                Debug.Log("setting up entry node sphere and label");

                logEntry.gameObject = new GameObject("logentry");
                logEntry.guiLabel = logEntry.gameObject.AddComponent<GUIText>();

                //onclick, onhover
                logEntry.guiLabel.fontSize = 20;
                logEntry.guiLabel.pixelOffset = new Vector2(-5, 10);
            }

            //logEntry.renderNode.renderer.material.SetColor("_EmissiveColor", LineColor);
            logEntry.guiLabel.material.color = LineColor;

            logEntry.unityPos = this.referenceBody.GetWorldSurfacePosition(logEntry.latitude, logEntry.longitude, logEntry.altitude);

            Vector2 screenPos = FlightCamera.fetch.cameras[0].WorldToViewportPoint(logEntry.gameObject.transform.position);
            //Vector3 orthoDir = Vector3.Cross(FlightGlobals.camera_position, entry.renderNode.transform.position).normalized;
            //Vector2 screenPosSphereEdge = FlightCamera.fetch.cameras[0].WorldToViewportPoint(
            //    entry.renderNode.transform.position + orthoDir * entry.renderNode.transform.localScale.x);

            //float offsetPixels = Math.Abs(screenPos.x - screenPosSphereEdge.x) * Screen.width * 1.2f;
            //Debug.Log("LogEntry node at " +logEntry.unityPos+ ", screenLabel at " + screenPos);

            logEntry.guiLabel.text = "[o]   " + logEntry.label;
        }
コード例 #2
0
ファイル: Track.cs プロジェクト: GrJo/KSPPersistentTrails
        public void addLogEntry(string label, string description)
        {
            LogEntry logEntry = new LogEntry(label, description, this.SourceVessel);
            logEntries.Add(logEntry);

            //add new point to renderer
            if (Visible)
            {
                setupLogEntryLabel(logEntry);
            }

            Modified = true;
        }