示例#1
0
        public override void OnStart(StartState state)
        {
            base.OnStart(state);
            var cullmix = (1 << 0) | (1 << 4) | (1 << 9) | (1 << 10) | (1 << 15) | (1 << 19) | (1 << 22) | (1 << 23) | (1 << 24) | (1 << 29) | (1 << 30);

            camer    = part.FindModelTransform("CameraICC");
            camerota = part.FindModelTransform("pivotcameraicc");
            _camera  = camer.GetComponent <Camera>();
            _camera.gameObject.AddComponent <FlareLayer>();
            _camera.gameObject.AddComponent <UnderwaterFog>();
            _camera.cullingMask = cullmix;
            camerarm1           = part.FindModelTransform("CameraArm1");
            _cameraarm1         = camerarm1.GetComponent <Camera>();
            _cameraarm1.gameObject.AddComponent <FlareLayer>();
            _cameraarm1.gameObject.AddComponent <UnderwaterFog>();
            _cameraarm1.cullingMask = cullmix;
            camerarm2   = part.FindModelTransform("CameraArm2");
            _cameraarm2 = camerarm2.GetComponent <Camera>();
            _cameraarm2.gameObject.AddComponent <FlareLayer>();
            _cameraarm2.gameObject.AddComponent <UnderwaterFog>();
            _cameraarm2.cullingMask = cullmix;
            resour = part.Resources;
            if (HighLogic.LoadedSceneIsFlight)
            {
                if (bapp2 == null)
                {
                    bapp2 = FindObjectOfType <ButtonApp>();
                    bapp2.Activado();
                }
            }
        }
示例#2
0
        public void Update()
        {
            if (HighLogic.LoadedSceneIsFlight)
            {
                if (bapp2 == null)
                {
                    bapp2 = FindObjectOfType <ButtonApp>();
                    bapp2.Activado();
                }
                foreach (PartResource reso in resour)
                {
                    if (reso.resourceName == resourceName)
                    {
                        if (reso.amount <= 0)
                        {
                            conelectricidad = false;
                        }
                        else
                        {
                            conelectricidad = true;
                            if (CommNet.VesselControlState.ProbeNone == vessel.connection.ControlState)
                            {
                                concomunicacion = false;
                            }
                            else
                            {
                                concomunicacion = true;
                            }
                        }
                    }
                }
                estaactivo = bapp2.guiactivada;
                if (estaactivo)
                {
                    if (bapp == null)
                    {
                        bapp = FindObjectOfType <MuestraUI>();
                    }

                    anglex = Mathf.Clamp(anglex, minangle, maxangle);
                    anglez = Mathf.Clamp(anglez, minangle, maxangle);
                    if (!conelectricidad)
                    {
                        NoPower();
                    }
                    if (conelectricidad)
                    {
                        if (!concomunicacion)
                        {
                            NoSignal();
                        }
                        if (concomunicacion)
                        {
                            WithPower();
                        }
                    }
                }
            }
        }