Esempio n. 1
0
 public void CommandFollow(ModuleWingCommander leader, int followerIndex)
 {
     Debug.Log(vessel.vesselName + " was commanded to follow.");
     command            = PilotCommands.Follow;
     commandLeader      = leader;
     commandFollowIndex = followerIndex;
 }
Esempio n. 2
0
        public void CommandFollow(ModuleWingCommander leader, int followerIndex)
        {
            if(!pilotEnabled)
            {
                return;
            }

            if(leader == vessel || followerIndex < 0)
            {
                return;
            }

            Debug.Log(vessel.vesselName + " was commanded to follow.");
            command = PilotCommands.Follow;
            commandLeader = leader;
            commandFollowIndex = followerIndex;
        }
        public void CommandFollow(ModuleWingCommander leader, int followerIndex)
        {
            if(!pilotEnabled)
            {
                return;
            }

            if(leader == vessel || followerIndex < 0)
            {
                return;
            }

            Debug.Log(vessel.vesselName + " was commanded to follow.");
            command = PilotCommands.Follow;
            commandLeader = leader;
            commandFollowIndex = followerIndex;

            foreach(var pilot in commandLeader.vessel.FindPartModulesImplementing<BDModulePilotAI>())
            {
                pilot.isLeadingFormation = true;
            }
        }
Esempio n. 4
0
		public override void OnStart (PartModule.StartState state)
		{
			UpdateMaxGuardRange();
			
			startTime = Time.time;

			UpdateTeamString();

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

				selectionMessage = new ScreenMessage("", 2, ScreenMessageStyle.LOWER_CENTER);
				
				UpdateList();
				if(weaponArray.Length > 0) selectedWeapon = weaponArray[weaponIndex];
				//selectedWeaponString = GetWeaponName(selectedWeapon);
				
				cameraTransform = part.FindModelTransform("BDARPMCameraTransform");
				
				part.force_activate();
				rippleTimer = Time.time;
				targetListTimer = Time.time;

				wingCommander = part.FindModuleImplementing<ModuleWingCommander>();
			

				audioSource = gameObject.AddComponent<AudioSource>();
				audioSource.minDistance = 1;
				audioSource.maxDistance = 500;
				audioSource.dopplerLevel = 0;
				audioSource.spatialBlend = 1;

				warningAudioSource = gameObject.AddComponent<AudioSource>();
				warningAudioSource.minDistance = 1;
				warningAudioSource.maxDistance = 500;
				warningAudioSource.dopplerLevel = 0;
				warningAudioSource.spatialBlend = 1;

				targetingAudioSource = gameObject.AddComponent<AudioSource>();
				targetingAudioSource.minDistance = 1;
				targetingAudioSource.maxDistance = 250;
				targetingAudioSource.dopplerLevel = 0;
				targetingAudioSource.loop = true;
				targetingAudioSource.spatialBlend = 1;

				StartCoroutine (MissileWarningResetRoutine());
				
				if(vessel.isActiveVessel)
				{
					BDArmorySettings.Instance.ActiveWeaponManager = this;
				}

				UpdateVolume();
				BDArmorySettings.OnVolumeChange += UpdateVolume;
				BDArmorySettings.OnSavedSettings += ClampVisualRange;

				StartCoroutine(StartupListUpdater());

				GameEvents.onVesselCreate.Add(OnVesselCreate);
				GameEvents.onPartJointBreak.Add(OnPartJointBreak);
				GameEvents.onPartDie.Add(OnPartDie);

				foreach(var aipilot in vessel.FindPartModulesImplementing<BDModulePilotAI>())
				{
					pilotAI = aipilot;
					break;
				}
			}
		}