Extended information about the selected target
 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;
     }
 }
 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;
     }
 }
Example #3
0
        public DockingCamera(Part part, bool noiseActive, string windowLabel = "DockCam")
            : base(part, windowLabel)
        {
            this.noiseActive   = noiseActive;
            target             = new TargetHelper(part);
            guiStyleRedLabel   = new GUIStyle(HighLogic.Skin.label);
            guiStyleGreenLabel = new GUIStyle(HighLogic.Skin.label);
            guiStyleRedLabel.normal.textColor   = Color.red;
            guiStyleGreenLabel.normal.textColor = Color.green;

            GameEvents.onVesselChange.Add(vesselChange);

            moduleDockingNodeGameObject = partGameObject.GetChild("dockingNode") ?? partGameObject;  //GET orientation from dockingnode

            if (textureWhiteNoise != null || !noiseActive)
            {
                return;
            }
            textureWhiteNoise = new List <Texture2D> [3];
            for (int j = 0; j < 3; j++)
            {
                textureWhiteNoise[j] = new List <Texture2D>();
                for (int i = 0; i < 4; i++)
                {
                    textureWhiteNoise[j].Add(Util.WhiteNoiseTexture((int)texturePosition.width, (int)texturePosition.height));
                }
            }
        }
Example #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);
            }
        }
        public DockingCamera(Part part, bool noiseActive, int windowSize, string windowLabel = "DockCam")
            : base(part, windowSize, windowLabel)
        {
            this.noiseActive = noiseActive;
            target = new TargetHelper(part);
            guiStyleRedLabel = new GUIStyle(HighLogic.Skin.label);
            guiStyleGreenLabel = new GUIStyle(HighLogic.Skin.label);
            guiStyleRedLabel.normal.textColor = Color.red;
            guiStyleGreenLabel.normal.textColor = Color.green;

            //GameEvents.onVesselChange.Add(vesselChange);

            moduleDockingNodeGameObject = partGameObject.GetChild("dockingNode") ?? partGameObject;  //GET orientation from dockingnode

            if (textureWhiteNoise != null || !noiseActive) return;
            textureWhiteNoise = new List<Texture2D>[3];
            for (int j = 0; j < 3; j++)
            {
                textureWhiteNoise[j] = new List<Texture2D>();
                for (int i = 0; i < 4; i++)
                    textureWhiteNoise[j].Add(Util.WhiteNoiseTexture((int)texturePosition.width, (int)texturePosition.height));
            }
        }
Example #6
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);
                }
        }
 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);
     }
 }