Update() 공개 메소드

public Update ( ) : void
리턴 void
예제 #1
0
 public void Activate()
 {
     if (camera.IsActivate)
     {
         return;
     }
     if (TargetHelper.IsTargetSelect)
     {
         var target = new TargetHelper(part);
         target.Update();
         if (target.Destination > allowedDistance)
         {
             ScreenMessages.PostScreenMessage("You need to set target and be closer than " + allowedDistance + " meters from target", 5f, ScreenMessageStyle.UPPER_CENTER);
             IsEnabled = false;
         }
         else
         {
             camera.Activate();
             StartCoroutine("WhiteNoiseUpdate"); //whitenoise
         }
     }
     else
     {
         ScreenMessages.PostScreenMessage("You need to set target", 5f, ScreenMessageStyle.UPPER_CENTER);
         IsEnabled = false;
     }
 }
예제 #2
0
 public void Activate()
 {
     if (camera.IsActivate) return;
     if (TargetHelper.IsTargetSelect )
     {
         var target = new TargetHelper(part);
         target.Update();
         if (target.Destination > allowedDistance)
         {
             ScreenMessages.PostScreenMessage("You need to set target and be closer than " + allowedDistance + " meters from target", 5f, ScreenMessageStyle.UPPER_CENTER);
             IsEnabled = false;
         }
         else
         {
             camera.Activate();
             //StartCoroutine(camera.ActivateOldTv(camera));
             StartCoroutine("WhiteNoiseUpdate"); //whitenoise
         }
     }
     else
     {
         ScreenMessages.PostScreenMessage("You need to set target", 5f, ScreenMessageStyle.UPPER_CENTER);
         IsEnabled = false;
     }
 }
예제 #3
0
        public IEnumerator WaitForRay()
        {
            yield return(new WaitForSeconds(1));

            IsRayEnabled = false;
            //var sciencePart = part.vessel.parts.First(a => a.name == "");
            var target = new TargetHelper(part);

            target.Update();
            Vector3 endPoint;

            if (target.Destination <= AllowedDistance && isInsight(out endPoint) && isTargetVisiable())
            {
                ScreenMessages.PostScreenMessage("HIT " + FlightGlobals.activeTarget.vessel.vesselName, 5f, ScreenMessageStyle.UPPER_CENTER);
                if (!scienceActivate)
                {
                    //try
                    //{

                    //    var science = new ModuleScienceExperiment
                    //    {
                    //        experimentID = "gravityScan",
                    //        useStaging = false,
                    //        useActionGroups = true,
                    //        hideUIwhenUnavailable = false,
                    //        xmitDataScalar = 0.4f,
                    //        dataIsCollectable = true,
                    //        interactionRange = 1.2f,
                    //        rerunnable = true,
                    //        usageReqMaskInternal = 1,
                    //        usageReqMaskExternal = 8,
                    //        part = part
                    //    };
                    var spyScience = part.GetComponent <ModuleSpyExperiment>();
                    //var spyScience = part.GetComponent<ModuleScienceExperiment>();
                    //var sciense = sciencePart.GetComponent<ModuleScienceExperiment>();
                    if (spyScience != null)
                    {
                        spyScience.DeployExperiment();
                    }
                    scienceActivate = true;
                    //    science.DeployExperiment();
                    //    scienceActivate = true;
                    //}
                    //catch (Exception e)
                    //{
                    //    int a = 10*1;
                    //}
                }
            }
            else
            {
                ScreenMessages.PostScreenMessage("OBJECT" + FlightGlobals.activeTarget.vessel.vesselName + " IS OUT OF RANGE", 5f, ScreenMessageStyle.UPPER_CENTER);
            }
        }
예제 #4
0
        public IEnumerator WaitForRay()
        {
            yield return new WaitForSeconds(1);
            IsRayEnabled = false;
            //var sciencePart = part.vessel.parts.First(a => a.name == "");
            var target = new TargetHelper(part);
            target.Update();
            Vector3 endPoint;
            if (target.Destination <= AllowedDistance && isInsight(out endPoint) && isTargetVisiable())
                {
                    ScreenMessages.PostScreenMessage("HIT " + FlightGlobals.activeTarget.vessel.vesselName, 5f, ScreenMessageStyle.UPPER_CENTER);
                    if (!scienceActivate)
                    {
                        //try
                        //{

                        //    var science = new ModuleScienceExperiment
                        //    {
                        //        experimentID = "gravityScan",
                        //        useStaging = false,
                        //        useActionGroups = true,
                        //        hideUIwhenUnavailable = false,
                        //        xmitDataScalar = 0.4f,
                        //        dataIsCollectable = true,
                        //        interactionRange = 1.2f,
                        //        rerunnable = true,
                        //        usageReqMaskInternal = 1,
                        //        usageReqMaskExternal = 8,
                        //        part = part
                        //    };
                        var spyScience = part.GetComponent<ModuleSpyExperiment>();
                        //var spyScience = part.GetComponent<ModuleScienceExperiment>();
                        //var sciense = sciencePart.GetComponent<ModuleScienceExperiment>();
                        if (spyScience != null)
                            spyScience.DeployExperiment();
                        scienceActivate = true;
                        //    science.DeployExperiment();
                        //    scienceActivate = true;
                        //}
                        //catch (Exception e)
                        //{
                        //    int a = 10*1;
                        //}
                    }
                }
            else
                {
                    ScreenMessages.PostScreenMessage("OBJECT" + FlightGlobals.activeTarget.vessel.vesselName + " IS OUT OF RANGE", 5f, ScreenMessageStyle.UPPER_CENTER);
                }
        }
예제 #5
0
 public IEnumerator WaitForRay()
 {
     yield return new WaitForSeconds(1);
     IsRayEnabled = false;
     var target = new TargetHelper(part);
     target.Update();
     Vector3 endPoint;
     if (target.Destination <= AllowedDistance && isInsight(out endPoint) && isTargetVisiable())
         {
             ScreenMessages.PostScreenMessage(FlightGlobals.activeTarget.vessel.vesselName + " HAS BEEN SCANNED", 3f, ScreenMessageStyle.UPPER_CENTER);
             if (!IsScienceActivate)
             {
                 var spyScience = part.GetComponent<ModuleSpyExperiment>();
                 if (spyScience != null)
                     spyScience.DeployExperiment();
                 IsScienceActivate = true;
             }
         }
     else
     {
         ScreenMessages.PostScreenMessage("NO DATA, TARGET " + FlightGlobals.activeTarget.vessel.vesselName + " IS OUT OF RANGE  OR VISIBILITY", 3f, ScreenMessageStyle.UPPER_CENTER);
     }
 }
예제 #6
0
        protected override void ExtendedDrawWindowL3()
        {
            if (GUI.RepeatButton(new Rect(7, 33, 20, 20), "-"))
            {
                currentZoom += 0.5f;
                if (currentZoom > maxZoom)
                {
                    currentZoom = maxZoom;
                }
            }
            if (GUI.RepeatButton(new Rect(26, 33, 20, 20), "+"))
            {
                currentZoom -= 0.5f;
                if (currentZoom < minZoom)
                {
                    currentZoom = minZoom;
                }
            }

            //LAMP&Seconds Block
            if (target.isMoveToTarget)
            {
                GUI.DrawTexture(new Rect(texturePosition.xMin + 20, texturePosition.yMax - 20, 20, 20),
                                textureLampOn);
                GUI.Label(new Rect(texturePosition.xMin + 40, texturePosition.yMax - 20, 140, 20),
                          String.Format("Time to dock:{0:f0}s", target.SecondsToDock));
            }
            else
            {
                GUI.DrawTexture(new Rect(texturePosition.xMin + 20, texturePosition.yMax - 20, 20, 20),
                                textureLampOff);
            }

            if (cameraData)
            {
                if (TargetHelper.IsTargetSelect && part.vessel.Equals(FlightGlobals.ActiveVessel))
                {
                    /// <summary>
                    /// DATA block
                    /// <summary>
                    float i = 0;
                    target.Update();

                    if (!target.isDockPort)
                    {
                        GUI.Label(new Rect(texturePosition.xMin + 10, 54, 100, 40),
                                  "Target is not\n a DockPort");
                        if (target.Destination < 200f)
                        {
                            GUI.Label(new Rect(texturePosition.xMin + 10, 84, 96, 40),
                                      "DockPort is\n available", guiStyleGreenLabel);
                        }
                    }

                    /// <summary>
                    /// FlightDATA
                    /// <summary>
                    GUI.Label(new Rect(texturePosition.xMax - 70, 32 + i++ *20, 70, 20),
                              String.Format("Dist:{0:f2}", target.Destination));
                    i += .2f;

                    GUI.Label(new Rect(texturePosition.xMax - 70, 32 + i++ *20, 70, 20),
                              String.Format("dx:{0:f2}", target.DX));
                    GUI.Label(new Rect(texturePosition.xMax - 70, 32 + i++ *20, 70, 20),
                              String.Format("dy:{0:f2}", target.DY));
                    GUI.Label(new Rect(texturePosition.xMax - 70, 32 + i++ *20, 70, 20),
                              String.Format("dz:{0:f2}", target.DZ));
                    i += .2f;

                    GUI.Label(new Rect(texturePosition.xMax - 70, 32 + i++ *20, 70, 20),
                              String.Format("vX:{0:f2}", target.SpeedX));
                    GUI.Label(new Rect(texturePosition.xMax - 70, 32 + i++ *20, 70, 20),
                              String.Format("vY:{0:f2}", target.SpeedY));
                    if (target.SpeedZ > MaxSpeed)
                    {
                        GUI.Label(new Rect(texturePosition.xMax - 70, 32 + i++ *20, 70, 20),
                                  String.Format("vZ:{0:f2}", target.SpeedZ), guiStyleRedLabel);
                    }
                    else
                    {
                        GUI.Label(new Rect(texturePosition.xMax - 70, 32 + i++ *20, 70, 20),
                                  String.Format("vZ:{0:f2}", target.SpeedZ));
                    }
                    i += .2f;

                    GUI.Label(new Rect(texturePosition.xMax - 70, 32 + i++ *20, 70, 20),
                              String.Format("Yaw:{0:f0}°", target.AngleX));
                    GUI.Label(new Rect(texturePosition.xMax - 70, 32 + i++ *20, 70, 20),
                              String.Format("Pitch:{0:f0}°", target.AngleY));
                    GUI.Label(new Rect(texturePosition.xMax - 70, 32 + i++ *20, 70, 20),
                              String.Format("Roll:{0:f0}°", target.AngleZ));
                    //i += .25f;
                }
            }

            if (targetCrossState)
            {
                ////RotationXY Block
                //TargetMoveHelp
                var textV = target.LookForward ? textureVLine : textureVLineBack;
                var textH = target.LookForward ? textureHLine : textureHLineBack;
                var tx    = target.TargetMoveHelpX;
                var ty    = target.TargetMoveHelpY;
                if (!target.LookForward)
                {
                    tx = 1 - tx;
                    ty = 1 - ty;
                }
                GUI.DrawTexture(
                    new Rect(texturePosition.xMin + Math.Abs(tx * texturePosition.width) % texturePosition.width,
                             texturePosition.yMin,
                             1,
                             texturePosition.height),
                    textV);
                GUI.DrawTexture(
                    new Rect(texturePosition.xMin,
                             texturePosition.yMin + Math.Abs(ty * texturePosition.height) % texturePosition.height,
                             texturePosition.width,
                             1),
                    textH);

                //RotationXY Block SE START
                //var tx = texturePosition.width / 2;
                //var ty = texturePosition.height / 2;
                //if (Mathf.Abs(target.AngleX) > 20)
                //    tx += (target.AngleX > 0 ? -1 : 1) * (texturePosition.width / 2 - 1);
                //else
                //    tx += (texturePosition.width / 40) * -target.AngleX;
                //if (Mathf.Abs(target.AngleY) > 20)
                //    ty += (target.AngleY > 0 ? -1 : 1) * (texturePosition.height / 2 - 1);
                //else
                //    ty += (texturePosition.height / 40) * -target.AngleY;
                //Matrix4x4 _matrixBackup = GUI.matrix;
                //GUIUtility.RotateAroundPivot(-target.AngleZ, new Vector2(tx,ty));
                //GUI.DrawTexture(new Rect(texturePosition.xMin + tx, -250, 1, 1000),textureVLine);
                //GUI.DrawTexture(new Rect(-250, texturePosition.yMin + ty, 1000, 1),textureHLine);
                //GUI.matrix = _matrixBackup;
                //RotationXY Block SE END
            }

            //RotationZ Block
            //if (rotatorState) // && TargetHelper.IsTargetSelect && part.vessel.Equals(FlightGlobals.ActiveVessel))
            //{
            //    var size = texturePosition.width / 5;
            //    var x = texturePosition.xMin + texturePosition.width / 2 - size / 2;
            //    GUI.DrawTexture(new Rect(x, texturePosition.yMax - size, size, size), textureRotationSelf);
            //    Matrix4x4 matrixBackup = GUI.matrix;
            //    var position = new Rect(x, texturePosition.yMax - size, size, size);
            //    GUIUtility.RotateAroundPivot(-target.AngleZ, position.center);
            //    //new Vector2(x + size / 2, texturePosition.yMax - size / 2));
            //    GUI.DrawTexture(position, textureRotationTarget);
            //    GUI.matrix = matrixBackup;
            //}
            if (rotatorState) // && TargetHelper.IsTargetSelect && part.vessel.Equals(FlightGlobals.ActiveVessel))
            {
                var size = texturePosition.width / 8;
                var x    = texturePosition.xMin + texturePosition.width / 2 - size / 2;
                GUI.DrawTexture(new Rect(x, texturePosition.yMax - size, size, size), textureRotationTarget);
                Matrix4x4 matrixBackup = GUI.matrix;
                var       position     = new Rect(x, texturePosition.yMax - size, size, size);
                GUIUtility.RotateAroundPivot(target.AngleZ, position.center);
                //new Vector2(x + size / 2, texturePosition.yMax - size / 2));
                GUI.DrawTexture(position, textureRotationSelf);
                GUI.matrix = matrixBackup;
            }

            base.ExtendedDrawWindowL3();
        }