internal void Draw_ShipSelector()
        {
            grav           = new GravityTools();
            vesselList     = FlightGlobals.Vessels;
            visibleVessels = new List <string>()
            {
            };

            GUILayout.BeginVertical();
            GUILayout.BeginHorizontal();
            GUILayout.Label("Ship");
            GUILayout.FlexibleSpace();
            GUILayout.Label("Options");
            GUILayout.EndHorizontal();

            foreach (Vessel v in vesselList)
            {
                float check_distance = Vector3.Distance(FlightGlobals.ActiveVessel.findWorldCenterOfMass(), v.findWorldCenterOfMass());
                if (check_distance < 2000F && v.id != FlightGlobals.ActiveVessel.id && !this.BeamIDList.Contains(v.id.ToString()))
                {
                    GUILayout.BeginHorizontal();
                    GUILayout.Label("" + v.vesselName);
                    GUILayout.FlexibleSpace();
                    if (GUILayout.Button("+"))
                    {
                        UnityEngine.Debug.Log("ImpulseDrive TractorBeam: Draw_ShipSelector CreateBeam was clicked : " + v.vesselName);
                        this.CreateBeam(v);
                    }
                    GUILayout.EndHorizontal();
                }
            }
            GUILayout.EndVertical();
        }
        internal void Draw_ShipSelector()
        {
            /*
             * if (rootPath==null)
             * {
             * rootPath = "file://" + KSPUtil.ApplicationRootPath.Replace("KSP_Data/../", "") + "GameData/SciFi/StarTrekImpulseDrive/sounds/";
             * clips = new AudioClip[1];
             * WWW www = new WWW(rootPath + "tng_tractor_clean.wav");
             * clips[0] = www.GetAudioClip(false);
             * PhaserSound.audio.clip = clips[0];
             * }
             */

            grav           = new GravityTools();
            vesselList     = FlightGlobals.Vessels;
            visibleVessels = new List <string>()
            {
            };

            GUILayout.BeginVertical();
            GUILayout.BeginHorizontal();
            GUILayout.Label("Ship");
            GUILayout.FlexibleSpace();
            GUILayout.Label("Options");
            GUILayout.EndHorizontal();

            foreach (Vessel v in vesselList)
            {
                if (v.id != FlightGlobals.ActiveVessel.id && !this.TargetIDList.Contains(v.id.ToString()) && v.loaded)
                {
                    GUILayout.BeginHorizontal();
                    GUILayout.Label("" + v.vesselName);
                    GUILayout.FlexibleSpace();
                    if (GUILayout.Button("+"))
                    {
                        UnityEngine.Debug.Log("ImpulseDrive WeaponSystems: Draw_ShipSelector CreateTarget was clicked : " + v.vesselName);
                        this.CreateTarget(v);
                    }
                    GUILayout.EndHorizontal();
                }
            }
            GUILayout.EndVertical();

            float power = PT1.L1_usage;

            this.PowSys.draw(PT1.takerName, power);
        }
Example #3
0
 public override void OnAwake()
 {
     man  = ImpulseVessel_manager.Instance;
     grav = new GravityTools();
 }
Example #4
0
        public override void OnStart(StartState state)
        {
            man  = ImpulseVessel_manager.Instance;
            grav = new GravityTools();
            try
            {
                //Debris
                GameObject go_Transporter = new GameObject("emitter_Transporter");
                emitter_Transporter = go_Transporter.AddComponent("EllipsoidParticleEmitter") as ParticleEmitter;
                ParticleAnimator animator_debris = go_Transporter.AddComponent <ParticleAnimator>();
                go_Transporter.AddComponent <ParticleRenderer>();
                (go_Transporter.renderer as ParticleRenderer).uvAnimationXTile = 7;
                (go_Transporter.renderer as ParticleRenderer).uvAnimationYTile = 7;
                Material mat = new Material(Shader.Find("Particles/Additive"));
                mat.mainTexture = GameDatabase.Instance.GetTexture("SciFi/StarTrekImpulseDrive/particles/transporter_7x7_optimized2", false);
                go_Transporter.renderer.material       = mat;
                emitter_Transporter.emit               = false;
                emitter_Transporter.minSize            = 10f; //radius * 0.05f;  //4    3 +
                emitter_Transporter.maxSize            = 10f; //radius * 0.1f;  //8
                emitter_Transporter.minEnergy          = 1;
                emitter_Transporter.maxEnergy          = 2;
                emitter_Transporter.rndVelocity        = Vector3.zero; //1.6f * radius; //150
                emitter_Transporter.useWorldSpace      = false;
                emitter_Transporter.rndAngularVelocity = 0;
                animator_debris.rndForce               = new Vector3(0, 0, 0);
                animator_debris.sizeGrow               = 0f;

                emitter_Transporter.transform.position = FlightGlobals.ActiveVessel.transform.position;
                emitter_Transporter.Emit(1);



                TransporterSound = new FXGroup("TransporterSound");
                GameObject audioObj = new GameObject();
                audioObj.transform.position         = FlightGlobals.ActiveVessel.transform.position;
                audioObj.transform.parent           = FlightGlobals.ActiveVessel.transform; // add to parent
                TransporterSound.audio              = audioObj.AddComponent <AudioSource>();
                TransporterSound.audio.dopplerLevel = 0f;
                TransporterSound.audio.Stop();
                TransporterSound.audio.clip = GameDatabase.Instance.GetAudioClip(TransporterSoundFile);
                TransporterSound.audio.loop = false;
                TransporterSound.audio.Play();
                TransporterSound.audio.enabled = false;
                if (TransporterSound != null && TransporterSound.audio != null)
                {
                    TransporterSound.audio.time = 0;
                    float soundVolume = GameSettings.SHIP_VOLUME * TransporterSoundVolume;
                    TransporterSound.audio.enabled = true;
                    TransporterSound.audio.volume  = soundVolume;
                }
            }
            catch (Exception ex)
            {
                Debug.LogError("TransporterSound Error : " + ex.Message);
            }

            if (TS == null)
            {
                TS = new LCARS_TransporterSystem();
            }

            try
            {
                ConfigNode newMSE = null;
                newMSE = new ConfigNode("MODULE");
                newMSE.AddValue("name", "ModuleScienceExperiment");
                newMSE.AddValue("experimentID", "TricorderAwayTeamStatus");
                newMSE.AddValue("experimentActionName", "AwayTeam's Log");
                newMSE.AddValue("resetActionName", "Delete Log");
                newMSE.AddValue("useStaging", "False");
                newMSE.AddValue("useActionGroups", "True");
                newMSE.AddValue("hideUIwhenUnavailable", "True");
                newMSE.AddValue("resettable", "True");
                newMSE.AddValue("xmitDataScalar", "10.0");
                newMSE.AddValue("FxModules", "0");
                this.vessel.rootPart.AddModule(newMSE);

                newMSE = new ConfigNode("MODULE");
                newMSE.AddValue("name", "ModuleScienceExperiment");
                newMSE.AddValue("experimentID", "TricorderAwayTeamSurfacescan");
                newMSE.AddValue("experimentActionName", "Surface Scan");
                newMSE.AddValue("resetActionName", "Delete Surface Scan");
                newMSE.AddValue("useStaging", "False");
                newMSE.AddValue("useActionGroups", "True");
                newMSE.AddValue("hideUIwhenUnavailable", "True");
                newMSE.AddValue("resettable", "True");
                newMSE.AddValue("xmitDataScalar", "10.0");
                newMSE.AddValue("FxModules", "0");
                this.vessel.rootPart.AddModule(newMSE);

                newMSE = new ConfigNode("MODULE");
                newMSE.AddValue("name", "ModuleScienceExperiment");
                newMSE.AddValue("experimentID", "TricorderAwayTeamAtmosphereScan");
                newMSE.AddValue("experimentActionName", "Atmosphere Scan");
                newMSE.AddValue("resetActionName", "Delete Atmosphere Scan");
                newMSE.AddValue("useStaging", "False");
                newMSE.AddValue("useActionGroups", "True");
                newMSE.AddValue("hideUIwhenUnavailable", "True");
                newMSE.AddValue("resettable", "True");
                newMSE.AddValue("xmitDataScalar", "10.0");
                newMSE.AddValue("FxModules", "0");
                this.vessel.rootPart.AddModule(newMSE);

                newMSE = new ConfigNode("MODULE");
                newMSE.AddValue("name", "ModuleScienceExperiment");
                newMSE.AddValue("experimentID", "TricorderAwayTeamLiquidScan");
                newMSE.AddValue("experimentActionName", "Liquid Scan");
                newMSE.AddValue("resetActionName", "Delete Liquid Scan");
                newMSE.AddValue("useStaging", "False");
                newMSE.AddValue("useActionGroups", "True");
                newMSE.AddValue("hideUIwhenUnavailable", "True");
                newMSE.AddValue("resettable", "True");
                newMSE.AddValue("xmitDataScalar", "10.0");
                newMSE.AddValue("FxModules", "0");
                this.vessel.rootPart.AddModule(newMSE);


                ModuleScienceExperimentList = new Dictionary <string, ModuleScienceExperiment>()
                {
                };
                foreach (PartModule PM in this.vessel.rootPart.Modules)
                {
                    if (PM.moduleName == "ModuleScienceExperiment")
                    {
                        ModuleScienceExperiment foo = PM as ModuleScienceExperiment;
                        ModuleScienceExperimentList.Add(foo.experimentID, foo);
                    }
                    //Debug.LogError("ModuleScienceExperiment rootPart.Module=" + PM.name);
                }

                /*
                 * MODULE
                 *  {
                 *          name = ModuleScienceExperiment
                 *          experimentID = enterprisestatus
                 *
                 *          experimentActionName = Captain's Log
                 *          resetActionName = Delete Log
                 *
                 *          useStaging = False
                 *          useActionGroups = True
                 *          hideUIwhenUnavailable = True
                 *          resettable = True
                 *
                 *          xmitDataScalar = 10.0
                 *
                 *          FxModules = 0
                 *  }
                 *
                 *  MODULE
                 *  {
                 *          name = ModuleScienceContainer
                 *
                 *          reviewActionName = Review Mission Data
                 *          storeActionName = Log Data
                 *          evaOnlyStorage = False
                 *          storageRange = 1000.0
                 *  }
                 *
                 *  MODULE
                 *  {
                 *          name = ModuleDataTransmitter
                 *
                 *          packetInterval = 0.01
                 *          packetSize = 0.5
                 *
                 *          packetResourceCost = 1000.0
                 *          requiredResource = ElectricCharge
                 *
                 *          DeployFxModules = 0
                 *  }
                 */
            }
            catch (Exception ex)
            {
                Debug.LogError("ModuleScienceExperiment Error : " + ex.Message);
            }
        }