createFXSound() 공개 정적인 메소드

public static createFXSound ( Part part, FXGroup group, string sndPath, bool loop, float maxDistance = 30f ) : bool
part Part
group FXGroup
sndPath string
loop bool
maxDistance float
리턴 bool
예제 #1
0
        public override void OnStart(StartState state)
        {
            base.OnStart(state);
            if (state == StartState.Editor || state == StartState.None)
            {
                return;
            }

            Events["ContextMenuRetract"].guiName = "Retract (" + KASAddonControlKey.telescopicRetractKey + ")";
            Events["ContextMenuExtend"].guiName  = "Extend (" + KASAddonControlKey.telescopicExtendKey + ")";

            KAS_Shared.createFXSound(this.part, fxSndMotorStart, motorStartSndPath, false);
            KAS_Shared.createFXSound(this.part, fxSndMotor, motorSndPath, true);
            KAS_Shared.createFXSound(this.part, fxSndMotorStop, motorStopSndPath, false);
            KAS_Shared.createFXSound(this.part, fxSndSection, sectionSndPath, false);

            LoadSections();

            if (savedSectionsLocalPos.Count > 0)
            {
                KAS_Shared.DebugLog("OnStart(TelescopicArm) - Re-set section position from save");
                foreach (KeyValuePair <int, SectionInfo> section in sections)
                {
                    KAS_Shared.DebugLog("OnStart(TelescopicArm) - Move section " + section.Key + " to local position : " + section.Value.savedLocalPos);
                    section.Value.transform.position = this.part.transform.TransformPoint(section.Value.savedLocalPos);
                }
            }
        }
예제 #2
0
        public override void OnStart(StartState state)
        {
            base.OnStart(state);
            if (state != StartState.None)
            {
                if (allowRelease)
                {
                    Actions["ActionGroupRelease"].active            = true;
                    Events["ContextMenuRelease"].guiActive          = true;
                    Events["ContextMenuRelease"].guiActiveUnfocused = true;
                }
                else
                {
                    Actions["ActionGroupRelease"].active            = false;
                    Events["ContextMenuRelease"].guiActive          = false;
                    Events["ContextMenuRelease"].guiActiveUnfocused = false;
                }
            }

            if (state == StartState.Editor || state == StartState.None)
            {
                return;
            }
            KAS_Shared.createFXSound(this.part, fxSndStore, sndStorePath, false);
            LoadBays();
        }
예제 #3
0
 public override void OnStart(StartState state)
 {
     base.OnStart(state);
     if (state == StartState.Editor || state == StartState.None)
     {
         return;
     }
     KAS_Shared.createFXSound(this.part, fxSndAttach, attachSndPath, false);
     KAS_Shared.createFXSound(this.part, fxSndDetach, detachSndPath, false);
 }
예제 #4
0
 public override void OnStart(StartState state)
 {
     base.OnStart(state);
     if (state == StartState.Editor || state == StartState.None)
     {
         return;
     }
     KAS_Shared.createFXSound(this.part, fxSndPlug, plugSndPath, false);
     KAS_Shared.createFXSound(this.part, fxSndUnplug, unplugSndPath, false);
     KAS_Shared.createFXSound(this.part, fxSndPlugDocked, plugDockedSndPath, false);
     KAS_Shared.createFXSound(this.part, fxSndUnplugDocked, unplugDockedSndPath, false);
 }
예제 #5
0
 public override void OnStart(StartState state)
 {
     base.OnStart(state);
     if (state == StartState.Editor || state == StartState.None)
     {
         return;
     }
     Events["Activate"].guiName = activateText;
     KAS_Shared.createFXSound(this.part, fxSndTimeStart, timeStartSndPath, false);
     KAS_Shared.createFXSound(this.part, fxSndTimeLoop, timeLoopSndPath, true);
     KAS_Shared.createFXSound(this.part, fxSndTimeEnd, timeEndSndPath, false);
 }
예제 #6
0
 public override void OnStart(StartState state)
 {
     base.OnStart(state);
     if (state == StartState.Editor || state == StartState.None)
     {
         return;
     }
     KAS_Shared.createFXSound(this.part, fxSndGrab, grabSndPath, false);
     KAS_Shared.createFXSound(this.part, fxSndAttachPart, attachPartSndPath, false);
     KAS_Shared.createFXSound(this.part, fxSndDetach, detachSndPath, false);
     KAS_Shared.createFXSound(this.part, fxSndAttachStatic, attachStaticSndPath, false);
     RefreshContextMenu();
 }
예제 #7
0
 public override void OnStart(StartState state)
 {
     base.OnStart(state);
     if (state == StartState.None)
     {
         return;
     }
     KAS_Shared.createFXSound(this.part, fxSndStore, sndStorePath, false);
     KAS_Shared.createFXSound(this.part, fxSndOpen, sndOpenPath, false);
     KAS_Shared.createFXSound(this.part, fxSndClose, sndClosePath, false);
     KAS_Shared.createFXSound(this.part, fxSndBipWrong, bipWrongSndPath, false);
     GameEvents.onVesselChange.Add(new EventData <Vessel> .OnEvent(this.OnVesselChange));
     orgMass = this.part.partInfo.partPrefab.mass;
     RefreshTotalSize();
 }
예제 #8
0
 public override void OnStart(StartState state)
 {
     base.OnStart(state);
     if (state == StartState.Editor || state == StartState.None)
     {
         return;
     }
     KAS_Shared.createFXSound(this.part, fxSndGrab, grabSndPath, false);
     KAS_Shared.createFXSound(this.part, fxSndAttachPart, attachPartSndPath, false);
     KAS_Shared.createFXSound(this.part, fxSndDetach, detachSndPath, false);
     KAS_Shared.createFXSound(this.part, fxSndAttachStatic, attachStaticSndPath, false);
     GameEvents.onCrewBoardVessel.Add(new EventData <GameEvents.FromToAction <Part, Part> > .OnEvent(this.OnCrewBoardVessel));
     GameEvents.onVesselChange.Add(new EventData <Vessel> .OnEvent(this.OnVesselChange));
     RefreshContextMenu();
 }
예제 #9
0
 public override void OnStart(StartState state)
 {
     base.OnStart(state);
     if (state == StartState.Editor || state == StartState.None)
     {
         return;
     }
     KAS_Shared.createFXSound(this.part, fxSndAttach, attachSndPath, false);
     KAS_Shared.createFXSound(this.part, fxSndDetach, detachSndPath, false);
     KAS_Shared.createFXSound(this.part, fxSndMagnet, magnetSndPath, true);
     KAS_Shared.createFXSound(this.part, fxSndMagnetStart, magnetStartSndPath, false);
     KAS_Shared.createFXSound(this.part, fxSndMagnetStop, magnetStopSndPath, false);
     if (attachMode.FixedJoint)
     {
         MagnetActive = true;
     }
 }
예제 #10
0
        public override void OnStart(StartState state)
        {
            KAS_Shared.DebugLog("OnStart(Rotor)");
            //Do not start from editor and at KSP first loading
            if (state == StartState.Editor || state == StartState.None)
            {
                return;
            }

            Events["ContextMenuMotorNegative"].guiName  = negativeWayText + " (" + KASAddonControlKey.rotorNegativeKey + ")";
            Events["ContextMenuMotorPositive"].guiName  = positiveWayText + " (" + KASAddonControlKey.rotorPositiveKey + ")";
            Actions["ActionGroupMotorNegative"].guiName = negativeWayText;
            Actions["ActionGroupMotorPositive"].guiName = positiveWayText;

            KAS_Shared.DebugLog("Loading rotor sounds...");
            KAS_Shared.createFXSound(this.part, fxSndMotorStart, motorStartSndPath, false);
            KAS_Shared.createFXSound(this.part, fxSndMotor, motorSndPath, true);
            KAS_Shared.createFXSound(this.part, fxSndMotorStop, motorStopSndPath, false);
        }
예제 #11
0
        public override void OnStart(StartState state)
        {
            base.OnStart(state);
            if (attachMode.StaticJoint || attachMode.FixedJoint)
            {
                Events["ContextMenuDetach"].guiActive          = true;
                Events["ContextMenuDetach"].guiActiveUnfocused = true;
            }
            else
            {
                Events["ContextMenuDetach"].guiActive          = false;
                Events["ContextMenuDetach"].guiActiveUnfocused = false;
            }

            KAS_Shared.createFXSound(this.part, fxSndAttachStatic, attachStaticSndPath, false);
            KAS_Shared.createFXSound(this.part, fxSndAttachPart, attachPartSndPath, false);
            KAS_Shared.createFXSound(this.part, fxSndAttachEva, attachEvaSndPath, false);
            KAS_Shared.createFXSound(this.part, fxSndDetach, detachSndPath, false);
        }
예제 #12
0
        public override void OnStart(StartState state)
        {
            base.OnStart(state);
            if (state == StartState.Editor || state == StartState.None)
            {
                return;
            }
            KAS_Shared.createFXSound(this.part, fxSndGrab, grabSndPath, false);
            KAS_Shared.createFXSound(this.part, fxSndAttachPart, attachPartSndPath, false);
            KAS_Shared.createFXSound(this.part, fxSndDetach, detachSndPath, false);
            KAS_Shared.createFXSound(this.part, fxSndAttachStatic, attachStaticSndPath, false);
            RefreshContextMenu();

            //Get attach node
            if (attachNodeName == null || attachNodeName == "")
            {
                if (this.part.srfAttachNode == null)
                {
                    KAS_Shared.DebugError("Grab - surface attach node cannot be found on the part !");
                    return;
                }
                KAS_Shared.AddNodeTransform(this.part, this.part.srfAttachNode);
                partNode = this.part.srfAttachNode;
            }
            else
            {
                AttachNode an = this.part.findAttachNode(attachNodeName);
                if (an == null)
                {
                    KAS_Shared.DebugError("Grab - " + attachNodeName + " node cannot be found on the part !");
                    return;
                }
                KAS_Shared.AddNodeTransform(this.part, an);
                partNode = an;
            }
        }
예제 #13
0
        public override void OnStart(StartState state)
        {
            base.OnStart(state);
            if (state == StartState.Editor || state == StartState.None)
            {
                return;
            }
            //Loading texture
            texStrut = GameDatabase.Instance.GetTexture(tubeTexPath, false);
            if (!texStrut)
            {
                KAS_Shared.DebugError("tube texture loading error !");
                ScreenMessages.PostScreenMessage(
                    "Texture file : " + tubeTexPath
                    + " as not been found, please check your KAS installation !",
                    10, ScreenMessageStyle.UPPER_CENTER);
            }
            // loading sounds
            KAS_Shared.createFXSound(this.part, fxSndLink, sndLinkPath, false);
            KAS_Shared.createFXSound(this.part, fxSndUnlink, sndUnlinkPath, false);
            KAS_Shared.createFXSound(this.part, fxSndBroke, sndBrokePath, false);

            // loading strut renderer
            strutRenderer = this.part.gameObject.AddComponent <KAS_Tube>();
            strutRenderer.tubeTexTilingOffset = textureTiling;
            strutRenderer.tubeScale           = tubeScale;
            strutRenderer.sphereScale         = jointScale;
            strutRenderer.tubeTexture         = texStrut;
            strutRenderer.sphereTexture       = texStrut;
            strutRenderer.tubeJoinedTexture   = texStrut;
            strutRenderer.srcNode             = strutTransform;

            // loading tube type
            switch (tubeSrcType)
            {
            case "None":
                strutRenderer.srcJointType = KAS_Tube.tubeJointType.None;
                break;

            case "Rounded":
                strutRenderer.srcJointType = KAS_Tube.tubeJointType.Rounded;
                break;

            case "ShiftedAndRounded":
                strutRenderer.srcJointType = KAS_Tube.tubeJointType.ShiftedAndRounded;
                break;

            case "Joined":
                strutRenderer.srcJointType = KAS_Tube.tubeJointType.Joined;
                break;

            default:
                strutRenderer.srcJointType = KAS_Tube.tubeJointType.Joined;
                break;
            }
            switch (tubeTgtType)
            {
            case "None":
                strutRenderer.tgtJointType = KAS_Tube.tubeJointType.None;
                break;

            case "Rounded":
                strutRenderer.tgtJointType = KAS_Tube.tubeJointType.Rounded;
                break;

            case "ShiftedAndRounded":
                strutRenderer.tgtJointType = KAS_Tube.tubeJointType.ShiftedAndRounded;
                break;

            case "Joined":
                strutRenderer.tgtJointType = KAS_Tube.tubeJointType.Joined;
                break;

            default:
                strutRenderer.tgtJointType = KAS_Tube.tubeJointType.Joined;
                break;
            }

            // Reset link if docked
            if (attachMode.Docked && !linked)
            {
                KAS_Shared.DebugLog("OnStart(strut) Docked strut detected from save, relinking...");
                KASModuleStrut linkedStrutModuleSavedD = dockedAttachModule.GetComponent <KASModuleStrut>();
                LinkTo(linkedStrutModuleSavedD, false, true);
            }

            // Loading onVesselWasModified KSP event
            GameEvents.onVesselWasModified.Add(new EventData <Vessel> .OnEvent(this.OnVesselWasModified));
        }