Exemplo n.º 1
0
        public override void OnStart(PartModule.StartState state)
        {
            if (!enabled)
            {
                return;
            }

            if ((state & PartModule.StartState.PreLaunch) != 0)
            {
                newFlight = true;

                doLightningJoke = rand.Next(10) == 0;
                if (doLightningJoke)
                {
                    tutorial = (MissionControlTutorial)ScenarioRunner.fetch.AddModule("MissionControlTutorial");
                }

                doRotationJoke = rand.Next(10) == 0;

                if (doRotationJoke)
                {
                    double[] rotationPeriods = { 1600, 1554, 1500, 1400, 1300, 1200, 1100, 1000, 750, 500, 250, 100, 50, 25, 10, 5, 1 };

                    vessel.mainBody.rotationPeriod = rotationPeriods[rand.Next(rotationPeriods.Length)];
                }

                if (lightningBundle == null)
                {
                    lightningBundle = AssetBundle.CreateFromMemory(Properties.Resources.lightning);
                }
            }

            if (state != PartModule.StartState.Editor)
            {
                Material munmat = GameObject.Find("scaledSpace").transform.Find("Mun").gameObject.renderer.material;

                if (munmat.mainTexture.name != "muntroll")
                {
                    Texture2D troll = new Texture2D(1024, 512, TextureFormat.ARGB32, true);
                    troll.LoadImage(Properties.Resources.troll);
                    troll.name = "muntroll";

                    munmat.mainTexture = troll;
                }
            }

            UnlockControls(); //in case the lock somehow remains in place
        }
Exemplo n.º 2
0
        public override void OnStart(PartModule.StartState state)
        {
            if (!enabled)
            {
                return;
            }

            if ((state & PartModule.StartState.PreLaunch) != 0)
            {
                newFlight = true;

                doLightningJoke = rand.Next(10) == 0;
                if (doLightningJoke) tutorial = (MissionControlTutorial)ScenarioRunner.fetch.AddModule("MissionControlTutorial");

                doRotationJoke = rand.Next(10) == 0;

                if (doRotationJoke)
                {
                    double[] rotationPeriods = { 1600, 1554, 1500, 1400, 1300, 1200, 1100, 1000, 750, 500, 250, 100, 50, 25, 10, 5, 1 };

                    vessel.mainBody.rotationPeriod = rotationPeriods[rand.Next(rotationPeriods.Length)];
                }

                if (lightningBundle == null)
                {
                    lightningBundle = AssetBundle.CreateFromMemory(Properties.Resources.lightning);
                }
            }

            if (state != PartModule.StartState.Editor)
            {
                Material munmat = GameObject.Find("scaledSpace").transform.Find("Mun").gameObject.renderer.material;

                if (munmat.mainTexture.name != "muntroll")
                {
                    Texture2D troll = new Texture2D(1024, 512, TextureFormat.ARGB32, true);
                    troll.LoadImage(Properties.Resources.troll);
                    troll.name = "muntroll";

                    munmat.mainTexture = troll;
                }
            }

            UnlockControls(); //in case the lock somehow remains in place
        }