コード例 #1
0
        public override void OnStart(StartState state)
        {
            base.OnStart(state);

            part.force_activate();

            //setup anim
            if (!string.IsNullOrEmpty(deployAnimationName))
            {
                hasDeployAnimation = true;
                deployAnimState    = Misc.Misc.SetUpSingleAnimation(deployAnimationName, part);
                if (state == StartState.Editor)
                {
                    Events["EditorToggleAnimation"].guiActiveEditor = true;
                }
            }

            if (HighLogic.LoadedSceneIsFlight)
            {
                List <ModuleTurret> .Enumerator tur = part.FindModulesImplementing <ModuleTurret>().GetEnumerator();
                while (tur.MoveNext())
                {
                    if (tur.Current == null)
                    {
                        continue;
                    }
                    if (tur.Current.turretID != turretID)
                    {
                        continue;
                    }
                    turret = tur.Current;
                    break;
                }
                tur.Dispose();

                attachedRadar = part.FindModuleImplementing <ModuleRadar>();
                if (attachedRadar)
                {
                    hasAttachedRadar = true;
                }

                finalTransform = part.FindModelTransform(finalTransformName);

                UpdateMissileChildren();

                if (!autoReturn)
                {
                    Events["ReturnTurret"].guiActive = true;
                }
            }
        }
コード例 #2
0
ファイル: RocketLauncher.cs プロジェクト: XOC2008/BDArmory
        public override void OnStart(StartState state)
        {
            // extension for feature_engagementenvelope
            InitializeEngagementRange(0, maxTargetingRange);

            if (HighLogic.LoadedSceneIsFlight)
            {
                part.force_activate();

                aimerTexture = BDArmorySetup.Instance.greenPointCircleTexture;
                // GameDatabase.Instance.GetTexture("BDArmory/Textures/grayCircle", false);


                MakeRocketArray();
                UpdateRocketScales();

                if (shortName == string.Empty)
                {
                    shortName = part.partInfo.title;
                }

                UpdateAudio();
                BDArmorySetup.OnVolumeChange += UpdateAudio;
            }

            if (HighLogic.LoadedSceneIsFlight || HighLogic.LoadedSceneIsEditor)
            {
                List <ModuleTurret> .Enumerator turr = part.FindModulesImplementing <ModuleTurret>().GetEnumerator();
                while (turr.MoveNext())
                {
                    if (turr.Current == null)
                    {
                        continue;
                    }
                    if (turr.Current.turretID != turretID)
                    {
                        continue;
                    }
                    turret             = turr.Current;
                    targetInTurretView = false;
                    break;
                }
                turr.Dispose();

                if (turret)
                {
                    Events["GuiFire"].guiActive  = false;
                    Events["Jettison"].guiActive = false;
                    Actions["AGFire"].active     = false;

                    if (HighLogic.LoadedSceneIsFlight)
                    {
                        Events["ToggleTurret"].guiActive = true;
                    }
                }

                if (!string.IsNullOrEmpty(deployAnimationName))
                {
                    deployAnimState    = Misc.Misc.SetUpSingleAnimation(deployAnimationName, part);
                    hasDeployAnimation = true;

                    readyToFire = false;
                }
            }
            SetupAudio();

            blastForce = BlastPhysicsUtils.CalculateExplosiveMass(blastRadius);
        }