Inheritance: UnityEngine.ScriptableObject
        public void Start()
        {
            engineManager = GetComponent <EngineManager>();
            if (engineManager == null)
            {
                Utilities.Log.Error("CyclopsEngineStateChangedCallouts can not find EngineManager - deleting");
                Destroy(this);
            }

            if (EntryPoint.LOAD_DEFAULT_CYCLOPS_ASSETS)
            {
                if (SilentRunningCallout == null)
                {
                    SilentRunningCallout = CyclopsDefaultAssets.ENGINE_STATE_SILENT_RUNNING;
                }

                if (NormalCallout == null)
                {
                    NormalCallout = CyclopsDefaultAssets.ENGINE_STATE_AHEAD_STANDARD;
                }

                if (SlowCallout == null)
                {
                    SlowCallout = CyclopsDefaultAssets.ENGINE_STATE_AHEAD_SLOW;
                }

                if (FastCallout == null)
                {
                    FastCallout = CyclopsDefaultAssets.ENGINE_STATE_AHEAD_FAST;
                }
            }
        }
Example #2
0
 public static void Postfix(FMODAsset asset)
 {
     if (fmodSystem.IsWhitelisted(asset.path, out bool isGlobal, out float radius))
     {
         fmodSystem.PlayAsset(asset.path, Player.main.transform.position.ToDto(), 1f, radius, isGlobal);
     }
 }
	void Awake()
	{
		currentAsset=(FMODAsset)target;
		FMODEditorExtension.StopEvent();
		isPlaying = false;
		
		// set up parameters
		FMOD.Studio.EventDescription desc = FMODEditorExtension.GetEventDescription(currentAsset.id);
		int count;
		
		if (desc == null)
		{
			return;
		}
		
		desc.is3D(out is3D);
		desc.getMinimumDistance(out minDistance);
		desc.getMaximumDistance(out maxDistance);
		
		desc.getParameterCount(out count);
		parameters = new Param[count];
		
		for (int i = 0; i < count; ++i)
		{
			desc.getParameterByIndex(i, out parameters[i].desc);			
			parameters[i].val = parameters[i].desc.minimum;			
		}
	}
Example #4
0
        private void Awake()
        {
            objectHelper = Main.graphics.objectHelper;

            animator = GetComponent <Animator>();

            front = objectHelper.FindDeepChild(gameObject, "hook").transform;
            ExosuitGrapplingArm component = GetComponent <ExosuitGrapplingArm>();

            hookPrefab = Instantiate(component.hookPrefab);
            rope       = objectHelper.GetObjectClone(component.rope);

            DestroyImmediate(hookPrefab.GetComponent <GrapplingHook>());
            DestroyImmediate(component);

            hook = hookPrefab.AddComponent <SeamothGrapplingHook>();
            hook.transform.parent        = front;
            hook.transform.localPosition = Vector3.zero;
            hook.transform.localRotation = Quaternion.identity;
            hook.transform.localScale    = new Vector3(1f, 1f, 1f);

            rope.attachPoint = hook.transform;

            grapplingLoopSound = GetComponent <FMOD_CustomLoopingEmitter>();

            shootSound      = ScriptableObject.CreateInstance <FMODAsset>();
            shootSound.path = "event:/sub/exo/hook_shoot";
            shootSound.name = "hook_shoot";
        }
        private void AudioTestMenu()
        {
            GUILayout.BeginHorizontal();

            FMODAsset waterFilterLoop = null;

            if (GUILayout.Button("Play Filter Audio"))
            {
                var machine = Resources.Load <GameObject>("Submarine/Build/FiltrationMachine");

                FMODAsset[] fmods = Resources.FindObjectsOfTypeAll <FMODAsset>();
                foreach (FMODAsset fmod in fmods)
                {
                    switch (fmod.name.ToLower())
                    {
                    case "water_filter_loop":
                        waterFilterLoop = fmod;
                        QuickLogger.Debug("Sound Located", true);
                        break;
                    }
                }


                if (waterFilterLoop != null)
                {
                    Utils.PlayFMODAsset(waterFilterLoop, MainCamera.camera.transform, 20f);
                }
                else
                {
                    QuickLogger.Error("WATER_FILTER_LOOP is null", true);
                }
            }

            GUILayout.EndHorizontal();
        }
        public void Awake()
        {
            Main = this;

            seamoth     = gameObject.GetComponent <SeaMoth>();
            energyMixin = seamoth.GetComponent <EnergyMixin>();
            var repulsionCannonPrefab = Resources.Load <GameObject>("WorldEntities/Tools/RepulsionCannon").GetComponent <RepulsionCannon>();

            //RepulsionCannon repulsionCannonPrefab = CraftData.InstantiateFromPrefab(TechType.RepulsionCannon, false).GetComponent<RepulsionCannon>();
            shootSound = Instantiate(repulsionCannonPrefab.shootSound, seamoth.transform);
            //Destroy(repulsionCannonPrefab);

            loopingEmitter       = gameObject.AddComponent <FMOD_CustomLoopingEmitter>();
            loopingEmitter.asset = shootSound;

            var powerRelayPrefab = Resources.Load <GameObject>("Submarine/Build/PowerTransmitter").GetComponent <PowerFX>();

            //PowerFX powerRelayPrefab = CraftData.InstantiateFromPrefab(TechType.PowerTransmitter, false).GetComponent<PowerFX>();
            laserBeam = Instantiate(powerRelayPrefab.vfxPrefab, seamoth.transform);
            laserBeam.SetActive(false);
            //Destroy(powerRelayPrefab);

            lineRenderer                = laserBeam.GetComponent <LineRenderer>();
            lineRenderer.startWidth     = 0.4f;
            lineRenderer.endWidth       = 0.4f;
            lineRenderer.receiveShadows = false;
            lineRenderer.loop           = false;

            SetBeamColor();
        }
    void Awake()
    {
        currentAsset = (FMODAsset)target;
        FMODEditorExtension.StopEvent();
        isPlaying = false;

        // set up parameters
        FMOD.Studio.EventDescription desc = FMODEditorExtension.GetEventDescription(currentAsset.id);
        int count;

        if (desc == null)
        {
            return;
        }

        desc.is3D(out is3D);
        desc.getMinimumDistance(out minDistance);
        desc.getMaximumDistance(out maxDistance);

        desc.getParameterCount(out count);
        parameters = new Param[count];

        for (int i = 0; i < count; ++i)
        {
            desc.getParameterByIndex(i, out parameters[i].desc);
            parameters[i].val = parameters[i].desc.minimum;
        }
    }
Example #8
0
        private void Awake()
        {
            objectHelper = Main.graphics.objectHelper;

            animator = GetComponent <Animator>();

            siloFirst  = objectHelper.FindDeepChild(gameObject, "TorpedoSiloFirst").transform;
            siloSecond = objectHelper.FindDeepChild(gameObject, "TorpedoSiloSecond").transform;

            visualTorpedoFirst  = objectHelper.FindDeepChild(gameObject, "TorpedoFirst");
            visualTorpedoSecond = objectHelper.FindDeepChild(gameObject, "TorpedoSecond");
            visualTorpedoReload = objectHelper.FindDeepChild(gameObject, "TorpedoReload");

            handTarget = gameObject.GetComponentInChildren <GenericHandTarget>(true);
            handTarget.onHandHover.AddListener(OnHoverTorpedoStorage);
            handTarget.onHandClick.AddListener(OnOpenTorpedoStorage);

            fireSound      = ScriptableObject.CreateInstance <FMODAsset>();
            fireSound.path = "event:/sub/seamoth/torpedo_fire";
            fireSound.name = "torpedo_fire";

            torpedoDisarmed      = ScriptableObject.CreateInstance <FMODAsset>();
            torpedoDisarmed.path = "event:/sub/seamoth/torpedo_disarmed";
            torpedoDisarmed.name = "torpedo_disarmed";
        }
        private void LoadFModAssets()
        {
            FMODAsset[] fmods = Resources.FindObjectsOfTypeAll <FMODAsset>();

            foreach (FMODAsset fmod in fmods)
            {
                switch (fmod.name.ToLower())
                {
                case "bioreactor_hatch_close":
                    QuickLogger.Debug("bioreactor_hatch_close found!", true);
                    _doorClose = fmod;
                    break;

                case "bioreactor_hatch_open":
                    QuickLogger.Debug("bioreactor_hatch_open found!", true);
                    _doorOpen = fmod;
                    break;
                }
            }

            if (_doorClose == null)
            {
                QuickLogger.Debug("bioreactor_hatch_close not found trying to search again...", true);
                Resources.Load <GameObject>("/sub/base/bioreactor_hatch_close");
                LoadFModAssets();
            }

            if (_doorOpen == null)
            {
                QuickLogger.Debug("bioreactor_hatch_open not found trying to search again...", true);
                Resources.Load <GameObject>("/sub/base/bioreactor_hatch_open");
                LoadFModAssets();
            }
        }
    private void Awake()
    {
        currentAsset = (FMODAsset)target;
        FMODEditorExtension.StopEvent();

        // Seting up parameters
        FMOD.Studio.EventDescription eventDescription = FMODEditorExtension.GetEventDescription(currentAsset.id);

        if (eventDescription == null)
        {
            return;
        }

        int count;

        eventDescription.GetParameterCount(out count);

        // Fetch parameters
        parameters.Clear();
        for (int i = 0; i < count; ++i)
        {
            Param parameter = new Param();
            eventDescription.GetParameterByIndex(i, out parameter.description);
            parameter.value = parameter.description.minimum;
        }
    }
Example #11
0
        private static void SurvivalPatchings(IDictionary <TechType, List <Action> > dictionary, GameObject obj, ref bool result)
        {
            TechType tt = CraftData.GetTechType(obj);

            if (dictionary.TryGetValue(tt, out List <Action> action))
            {
                action.ForEach((x) => x.Invoke());
                result = true;
            }
            if (result)
            {
#if SUBNAUTICA
#pragma warning disable CS0618 // Type or member is obsolete and yet IS still used by Subnautica itself.
                string sound = CraftData.GetUseEatSound(tt);
                if (!string.IsNullOrEmpty(sound))
                {
                    FMODUWE.PlayOneShot(sound, Player.main.transform.position); // only play the sound if its useable
                }
#pragma warning restore CS0618
#elif BELOWZERO
                FMODAsset asset = Player.main.GetUseSound(TechData.GetSoundType(tt));
                if (asset != null)
                {
                    FMODUWE.PlayOneShot(asset, Player.main.transform.position); // only play the sound if its useable
                }
#endif
            }
        }
Example #12
0
        private void Start()
        {
            animator     = GetComponent <Animator>();
            fxControl    = GetComponent <VFXController>();
            vfxEventType = VFXEventTypes.impact;

            foreach (FMODAsset asset in GetComponents <FMODAsset>())
            {
                if (asset.name == "claw_hit_terrain")
                {
                    hitTerrainSound = asset;
                }

                if (asset.name == "claw_hit_fish")
                {
                    hitFishSound = asset;
                }

                if (asset.name == "claw_pickup")
                {
                    pickupSound = asset;
                }
            }


            front = gameObject.FindChildInMaxDepth("wrist").transform;
        }
Example #13
0
        public void Start()
        {
            if (EntryPoint.LOAD_DEFAULT_CYCLOPS_ASSETS)
            {
                if (ImpactHitHard == null)
                {
                    ImpactHitHard = CyclopsDefaultAssets.COLLISION_IMPACT_SOLID_HARD;
                }

                if (ImpactHitMedium == null)
                {
                    ImpactHitMedium = CyclopsDefaultAssets.COLLISION_IMPACT_SOLID_MEDIUM;
                }

                if (ImpactHitSoft == null)
                {
                    ImpactHitSoft = CyclopsDefaultAssets.COLLISION_IMPACT_SOLID_SOFT;
                }
            }

            if (ImpactHitHard == null)
            {
                Utilities.Log.Error("CollisionSounds::ImpactHitHard is not set. To set attach the FMOD asset name 'impact_solid_hard' ");
            }

            if (ImpactHitMedium == null)
            {
                Utilities.Log.Error("CollisionSounds::ImpactHitMedium is not set. To set attach the FMOD asset name 'impact_solid_medium' ");
            }

            if (ImpactHitSoft == null)
            {
                Utilities.Log.Error("CollisionSounds::ImpactHitMedium is not set. To set attach the FMOD asset name 'impact_solid_soft' ");
            }
        }
        private void Start()
        {
            objectHelper = new ObjectHelper();

            thisSeamoth = GetComponent <SeaMoth>();
            liveMixin   = GetComponent <LiveMixin>();
            energyMixin = GetComponent <EnergyMixin>();

            shield_on_loop      = ScriptableObject.CreateInstance <FMODAsset>();
            shield_on_loop.name = "shield_on_loop";
            shield_on_loop.path = "event:/sub/cyclops/shield_on_loop";
            sfx              = gameObject.AddComponent <FMOD_CustomEmitter>();
            sfx.asset        = shield_on_loop;
            sfx.followParent = true;

            GameObject CyclopsPrefab = objectHelper.GetRootGameObject("Cyclops", "Cyclops-MainPrefab");

            SubRoot subRoot = CyclopsPrefab.GetComponent <SubRoot>();

            shieldFX = Instantiate(subRoot.shieldFX, transform);

            shieldFX.gameObject.SetActive(false);

            Utils.ZeroTransform(shieldFX.transform);

            shieldFX.transform.localRotation = Quaternion.Euler(0f, 180f, 0f);

            thisSeamoth.onToggle             += OnToggle;
            thisSeamoth.modules.onAddItem    += OnAddItem;
            thisSeamoth.modules.onRemoveItem += OnRemoveItem;
        }
        public void Awake()
        {
            Instance     = this;
            useGUILayout = false;

            warpSound      = ScriptableObject.CreateInstance <FMODAsset>();
            warpSound.path = "event:/tools/gravcannon/fire";

            TechnologyMatrix = new List <TechMatrix.TechTypeData> [TechMatrix.techMatrix.Length];
            TechMatrix.InitTechMatrixList(ref TechnologyMatrix);

            if (Main.isExistsSMLHelperV2)
            {
                TechMatrix.IsExistsModdersTechTypes(ref TechnologyMatrix, TechMatrix.Known_Modded_TechTypes);
            }
            else
            {
                Logger.Log("[CheatManager] Warning:\n'SMLHelper.V2' not found! Some functions are not available!", LogType.Warning);
            }
            TechMatrix.SortTechLists(ref TechnologyMatrix);

            Buttons         = new List <GUIHelper.ButtonInfo>();
            toggleButtons   = new List <GUIHelper.ButtonInfo>();
            daynightTab     = new List <GUIHelper.ButtonInfo>();
            categoriesTab   = new List <GUIHelper.ButtonInfo>();
            vehicleSettings = new List <GUIHelper.ButtonInfo>();

            GUIHelper.CreateButtonsList(ButtonText.Buttons, GUIHelper.BUTTONTYPE.NORMAL_CENTER, ref Buttons);
            GUIHelper.CreateButtonsList(ButtonText.ToggleButtons, GUIHelper.BUTTONTYPE.TOGGLE_CENTER, ref toggleButtons);
            GUIHelper.CreateButtonsList(ButtonText.DayNightTab, GUIHelper.BUTTONTYPE.TAB_CENTER, ref daynightTab);
            GUIHelper.CreateButtonsList(ButtonText.CategoriesTab, GUIHelper.BUTTONTYPE.TAB_CENTER, ref categoriesTab);

            var    searchSeaGlide = new TechMatrix.TechTypeSearch(TechType.Seaglide);
            string seaglideName   = TechnologyMatrix[1][TechnologyMatrix[1].FindIndex(searchSeaGlide.EqualsWith)].Name;

            var searchSeamoth = new TechMatrix.TechTypeSearch(TechType.Seamoth);

            seamothName = TechnologyMatrix[0][TechnologyMatrix[0].FindIndex(searchSeamoth.EqualsWith)].Name;

            var searchExosuit = new TechMatrix.TechTypeSearch(TechType.Exosuit);

            exosuitName = TechnologyMatrix[0][TechnologyMatrix[0].FindIndex(searchExosuit.EqualsWith)].Name;

            var searchCyclops = new TechMatrix.TechTypeSearch(TechType.Cyclops);

            cyclopsName = TechnologyMatrix[0][TechnologyMatrix[0].FindIndex(searchCyclops.EqualsWith)].Name;

            string[] vehicleSetButtons = { $"{seamothName} Can Fly", $"{seaglideName} Speed Fast" };

            GUIHelper.CreateButtonsList(vehicleSetButtons, GUIHelper.BUTTONTYPE.TOGGLE_CENTER, ref vehicleSettings);

            daynightTab[4].Pressed    = true;
            categoriesTab[0].Pressed  = true;
            toggleButtons[17].Pressed = false;
            Buttons[7].Enabled        = false;
            Buttons[7].Pressed        = true;

            exosuitSpeedMultiplier = 1;
            cyclopsSpeedMultiplier = 1;
        }
        public void Awake()
        {
            //helper = new SeaTruckHelper(gameObject, false, false, false);
            helper = SeatruckServices.Main.GetSeaTruckHelper(gameObject);

            mainCab     = helper.MainCab;
            motor       = helper.TruckMotor;
            engineSound = motor.engineSound;
            rigidbody   = helper.TruckWorldForces.useRigidbody;

            CoroutineHost.StartCoroutine(LoadBiodomeRobotArmResourcesAsync());

            CoroutineHost.StartCoroutine(Init_Graphics());

            engineDefault      = ScriptableObject.CreateInstance <FMODAsset>();
            engineDefault.name = "engine";
            engineDefault.path = "event:/bz/vehicles/seatruck/engine";

            engine      = ScriptableObject.CreateInstance <FMODAsset>();
            engine.name = "engine";
            engine.path = "event:/sub/drone/motor_loop";

            isFlying.changedEvent.AddHandler(this, new Event <Utils.MonitoredValue <bool> > .HandleFunction(OnFlyModeChanged));

            mainCabExitPoint = helper.TruckSegment.exitPosition.localPosition;

            //helper.onPilotingBegin += OnPilotingBegin;

#if DEBUG
            CoroutineHost.StartCoroutine(InitDebugHUD());
#endif
        }
        public void Awake()
        {
            seamoth         = gameObject.GetComponent <SeaMoth>();
            leftTorpedoSlot = seamoth.torpedoTubeLeft.transform;
            energyMixin     = seamoth.GetComponent <EnergyMixin>();

            var scannerPrefab = Resources.Load <GameObject>("WorldEntities/Tools/Scanner").GetComponent <ScannerTool>();

            //ScannerTool scannerPrefab = CraftData.InstantiateFromPrefab(TechType.Scanner, false).GetComponent<ScannerTool>();
            scanSound     = Instantiate(scannerPrefab.scanSound, gameObject.transform);
            completeSound = Instantiate(scannerPrefab.completeSound, gameObject.transform);
            fxControl     = Instantiate(scannerPrefab.fxControl, gameObject.transform);
            scanBeam      = Instantiate(scannerPrefab.scanBeam, leftTorpedoSlot.transform);

            MeshRenderer[] renderers             = scannerPrefab.GetComponentsInChildren <MeshRenderer>(true);
            Renderer       instantiated_renderer = Instantiate(renderers[0]);

            scanCircuitTex = instantiated_renderer.materials[0].mainTexture;
            scanOrganicTex = instantiated_renderer.materials[2].mainTexture;

            //Destroy(instantiated_renderer);
            //Resources.UnloadAsset(scannerPrefab);

            scanBeam.transform.localScale    = new Vector3(1, 4, 1);
            scanBeam.transform.localRotation = new Quaternion(-0.7683826f, 0.1253118f, 0.0448633f, 0.6259971f);
        }
 public void Start()
 {
     if (EntryPoint.LOAD_DEFAULT_CYCLOPS_ASSETS && WelcomeAboardCallout == null)
     {
         WelcomeAboardCallout = CyclopsDefaultAssets.AI_WELCOME_ABOARD_GOOD;
     }
 }
Example #19
0
 private void OnStopMiningSound(object data)
 {
     if (miningSoundEvent != null)
     {
         loopingSounds.StopSound(miningSoundEvent);
         miningSound = null;
     }
 }
Example #20
0
        public void Awake()
        {
            leftSide  = weaponFXParent.transform.Find("LeftBarrel").gameObject;
            rightSide = weaponFXParent.transform.Find("RightBarrel").gameObject;

            RepulsionCannon cannon = CraftData.GetPrefabForTechType(TechType.RepulsionCannon).GetComponent <RepulsionCannon>();

            shootSound = cannon.shootSound;
        }
        private void Awake()
        {
            objectHelper = Main.objectHelper;

            Instance    = gameObject.GetComponent <LaserCannonControl>();
            thisSeamoth = Instance.GetComponent <SeaMoth>();
            energyMixin = thisSeamoth.GetComponent <EnergyMixin>();
            playerMain  = Player.main;
            PdaMain     = playerMain.GetPDA();

            isPlayerInThisVehicle = playerMain.GetVehicle() == thisSeamoth ? true : false;

            GameObject repulsionCannonPrefab = Instantiate(Resources.Load <GameObject>("WorldEntities/Tools/RepulsionCannon"));

            shootSound = objectHelper.GetObjectClone(repulsionCannonPrefab.GetComponent <RepulsionCannon>().shootSound);

            DestroyImmediate(repulsionCannonPrefab);

            loopingEmitter       = gameObject.AddComponent <FMOD_CustomLoopingEmitter>();
            loopingEmitter.asset = shootSound;

            GameObject powerTransmitterPrefab = Instantiate(Resources.Load <GameObject>("Submarine/Build/PowerTransmitter"));

            GameObject laserBeam = objectHelper.GetGameObjectClone(powerTransmitterPrefab.GetComponent <PowerFX>().vfxPrefab, null, false);

            LineRenderer lineRenderer = laserBeam.GetComponent <LineRenderer>();

            lineRenderer.startWidth     = 0.2f;
            lineRenderer.endWidth       = 0.2f;
            lineRenderer.positionCount  = 2;
            lineRenderer.receiveShadows = false;
            lineRenderer.loop           = false;

            laserRight      = objectHelper.GetGameObjectClone(laserBeam, thisSeamoth.torpedoTubeRight, false);
            laserRight.name = "laserRight";
            laserRight.transform.localPosition = Vector3.zero;
            laserRight.transform.localRotation = Quaternion.identity;
            rightBeam = laserRight.GetComponent <LineRenderer>();

            laserLeft      = objectHelper.GetGameObjectClone(laserBeam, thisSeamoth.torpedoTubeLeft, false);
            laserLeft.name = "laserLeft";
            laserLeft.transform.localPosition = Vector3.zero;
            laserLeft.transform.localRotation = Quaternion.identity;
            leftBeam = laserLeft.GetComponent <LineRenderer>();

            DestroyImmediate(laserBeam);
            DestroyImmediate(powerTransmitterPrefab);

            OnConfigChanged(true);

            thisSeamoth.onToggle             += OnToggle;
            thisSeamoth.modules.onAddItem    += OnAddItem;
            thisSeamoth.modules.onRemoveItem += OnRemoveItem;
            playerMain.playerModeChanged.AddHandler(this, new Event <Player.Mode> .HandleFunction(OnPlayerModeChanged));

            Main.OnConfigChanged.AddHandler(this, new Event <bool> .HandleFunction(OnConfigChanged));
        }
Example #22
0
        void Awake()
        {
            exosuit = gameObject.GetComponent <Exosuit>();

            sonarSoundAsset      = ScriptableObject.CreateInstance <FMODAsset>();
            sonarSoundAsset.path = "event:/sub/seamoth/sonar_loop";
            sonarSound           = gameObject.AddComponent <FMOD_CustomEmitter>();
            sonarSound.asset     = sonarSoundAsset;
        }
Example #23
0
        // Creates an audio asset.
        public static FMODAsset CreateAsset(string id, string name, string path)
        {
            FMODAsset asset = ScriptableObject.CreateInstance <FMODAsset>();

            asset.name = name;
            asset.id   = id;
            asset.path = path;
            return(asset);
        }
 public static FMOD.Studio.EventInstance GetEvent(FMODAsset eventPath)
 {
     var ev = FMOD_StudioSystem.instance.GetEvent(eventPath);
     if(ev == null)
     {
         Debug.LogError(string.Format("Could not load FMOD event at path '{0}'", ev));
         Debug.DebugBreak();
     }
     return ev;
 }
 /// <summary>
 /// Adds a custom log entry.
 /// </summary>
 /// <param name="key">The key to refer to this entry.</param>
 /// <param name="languageKey">The subtitles language key for this entry.</param>
 /// <param name="icon">The icon that will be used in the Log tab for this entry. if <c>null</c> It will use the default log entry icon.</param>
 /// <param name="sound">The sound that will be played once this entry is triggered or played in the Log tab.<br/>
 /// If <c>null</c> the Play button in the Log tab will disappear and a sound wont play when this entry is triggered.</param>
 void IPDALogHandler.AddCustomEntry(string key, string languageKey, Sprite icon, FMODAsset sound)
 {
     PDALog.EntryData entry = new()
     {
         key   = languageKey,
         icon  = icon,
         sound = sound
     };
     PDALogPatcher.CustomEntryData[key] = entry;
 }
Example #26
0
 public void Awake()
 {
     thisVehicle         = gameObject.GetComponent <Vehicle>();
     energyMixin         = thisVehicle.GetComponent <EnergyMixin>();
     weldSoundAsset      = ScriptableObject.CreateInstance <FMODAsset>();
     weldSoundAsset.path = "event:/tools/welder/weld_loop";
     weldSound           = gameObject.AddComponent <FMOD_CustomLoopingEmitter>();
     weldSound.asset     = weldSoundAsset;
     repairPerSec        = thisVehicle.liveMixin.maxHealth * 0.1f;
 }
Example #27
0
        public void Awake()
        {
            Instance    = this;
            thisVehicle = Instance.GetComponent <SeaTruckUpgrades>();
            energyMixin = thisVehicle.relay;
            playerMain  = Player.main;
            var builderPrefab = Resources.Load <GameObject>("WorldEntities/Tools/Builder").GetComponent <BuilderTool>();

            completeSound = Instantiate(builderPrefab.completeSound, gameObject.transform);
        }
        public void Awake()
        {
            this.Instance    = this;
            this.ThisVehicle = this.Instance.GetComponent <Vehicle>();
            this.EnergyMixin = this.ThisVehicle.GetComponent <EnergyMixin>();
            this.PlayerMain  = Player.main;
            BuilderTool builderPrefab = Resources.Load <GameObject>("WorldEntities/Tools/Builder").GetComponent <BuilderTool>();

            completeSound = Instantiate(builderPrefab.completeSound, this.gameObject.transform);
        }
Example #29
0
        void Awake()
        {
            vehicle = gameObject.GetComponent <Vehicle>();

            soundAsset      = ScriptableObject.CreateInstance <FMODAsset>();
            soundAsset.path = "event:/tools/flashlight/turn_on";
            sound           = gameObject.AddComponent <FMOD_CustomEmitter>();
            sound.asset     = soundAsset;

            Player.main.playerModeChanged.AddHandler(gameObject, new Event <Player.Mode> .HandleFunction(onPlayerModeChanged));
        }
Example #30
0
        public void Awake()
        {
            rb         = GetComponent <Rigidbody>();
            collision  = GetComponent <Collider>();
            fxControl  = GetComponent <VFXController>();
            fixedJoint = GetComponent <FixedJoint>();

            hitSound      = ScriptableObject.CreateInstance <FMODAsset>();
            hitSound.path = "event:/sub/exo/hook_hit";
            hitSound.name = "hook_hit";
        }
        public override void Awake()
        {
            muzzle    = ArmServices.main.objectHelper.FindDeepChild(gameObject, "muzzle").transform;
            fxControl = GetComponent <VFXController>();
            bubblesFX = transform.Find("xRepulsionCannon_Bubbles").gameObject;

            shootSound      = ScriptableObject.CreateInstance <FMODAsset>();
            shootSound.name = "repulsiom";
            shootSound.id   = "fire";
            shootSound.path = "event:/tools/gravcannon/fire";
        }
 public void Awake()
 {
     exosuit                 = gameObject.GetComponent <Exosuit>();
     energyMixin             = exosuit.GetComponent <EnergyMixin>();
     scanSoundAsset          = ScriptableObject.CreateInstance <FMODAsset>();
     scanSoundAsset.path     = "event:/tools/scanner/scan_loop";
     scanSound               = gameObject.AddComponent <FMOD_CustomLoopingEmitter>();
     scanSound.asset         = scanSoundAsset;
     completeSoundAsset      = ScriptableObject.CreateInstance <FMODAsset>();
     completeSoundAsset.path = "event:/tools/scanner/scan_complete";
 }
    void Awake()
    {
        currentAsset=(FMODAsset)target;
        FMODEditorExtension.StopEvent();
        isPlaying = false;

        // set up parameters
        FMOD.Studio.EventDescription desc = FMODEditorExtension.GetEventDescription(currentAsset.id);
        int count;
        desc.getParameterCount(out count);
        parameters = new Param[count];

        for (int i = 0; i < count; ++i)
        {
            desc.getParameterByIndex(i, out parameters[i].desc);
            parameters[i].val = parameters[i].desc.minimum;
        }
    }
Example #34
0
	void PlayMovieSound()
	{
		if(Evt != null)
		{
			Evt.stop ();
		}
		if(m_SoundStack.Count != 0)
		{

			m_SoundAsset = m_SoundStack.Pop();
			CacheEventInstance(m_SoundAsset);
			if(m_Parameters != null && m_ParameterValues != null)
			{
				Evt.setParameterValue(m_Parameters[m_SoundStack.Count], m_ParameterValues[m_SoundStack.Count]);	
			}
			++m_Counter;
			StartEvent();
			m_Played = true;
		}
	}
Example #35
0
 //Not overloaded since people might not be aware of how FMOD handles oneshots
 public FMOD.Studio.EventInstance startEvent(FMODAsset soundEvent, bool playOnce)
 {
     if (FMOD_StudioSystem.instance.GetEvent (soundEvent) != null)
     {
         if (playOnce == true)
         {
             FMOD_StudioSystem.instance.PlayOneShot(soundEvent, transform.position);
             return null;
         }
         else
         {
             eventList.Add(FMOD_StudioSystem.instance.GetEvent(soundEvent));
             FMOD.Studio.EventInstance temp = eventList.Last();
             temp.start();
             return temp;
         }
     }
     else
     {
         Debug.LogError("FMOD Asset " + soundEvent + " not found");
         return null;
     }
 }
 private void SetFmodAsset(FMODAsset sound)
 {
     path = sound;
     eSound = FMODUtility.GetEvent(path);
     pState = FMODUtility.GetParameter(eSound, STATE_PARAMETER);
     pVolume = FMODUtility.GetParameter(eSound, VELOCITY_PARAMETER);
     pMood = FMODUtility.GetParameter(eSound, MOOD_PARAMETER);
 }
Example #37
0
	public void PlayOneShot(FMODAsset asset, Vector3 position)
	{
		PlayOneShot(asset.id, position);
	}	
Example #38
0
	public FMOD.Studio.EventInstance GetEvent(FMODAsset asset)
	{
		return GetEvent(asset.id);
	}
Example #39
0
	public void CacheEventInstance(FMODAsset p_Asset)
	{
		if (p_Asset != null)
		{
			m_Event = FMOD_StudioSystem.instance.GetEvent(p_Asset.id);
		}
		else if (!String.IsNullOrEmpty(m_Path))
		{
			m_Event = FMOD_StudioSystem.instance.GetEvent(m_Path);
		}
		else
		{
			FMOD.Studio.UnityUtil.LogError("No Asset/path for the Event");
		}
	}
Example #40
0
 public void Init(FMODAsset asset)
 {
     this.asset = asset;
     startEventOnAwake = false;
 }
	void OnGUI()
	{

		bool applyToAll = false; 
		bool apply = false; 
		bool remove = false;
		bool removeAll = false;

		NGUIEditorTools.DrawHeader("Text field", true);
		{
			NGUIEditorTools.BeginContents();

			if(m_Roots.Count > 0)
			{
				m_RootNames[0] = "None";
				int i = 1;
				foreach(GameObject go in m_Roots)
				{
					m_RootNames[i] = go.name;
				}

				m_Index = EditorGUILayout.Popup("Roots", m_Index, m_RootNames);
			}

			EditorGUILayout.BeginHorizontal ();
			m_Asset = EditorGUILayout.ObjectField ("Sound Effect", m_Asset, typeof(FMODAsset), false) as FMODAsset;
			EditorGUILayout.EndHorizontal ();
			NGUIEditorTools.EndContents();
		}

		EditorGUILayout.HelpBox ("\"Apply To All:\" Select the Root object, will apply the sound to all buttons within the hierarchy!\n" +
								 "\"Apply:\" Select any of the parent to a button group to apply the sound to specific button groups!\n" +
								 "\"Remove:\" Select any of the parent to a button group to remove the sound to specific button groups!\n", 
		                         MessageType.Info);
		GUILayout.Space (10f);

		GUILayout.BeginHorizontal ();

		EditorGUI.BeginDisabledGroup (m_Asset == null);
		GUI.color = Color.green;
		applyToAll = GUILayout.Button ("Apply To All", GUILayout.Width(200));
		GUI.color = Color.white;
		EditorGUI.EndDisabledGroup ();

		EditorGUI.BeginDisabledGroup (m_Asset == null);
		GUI.color = Color.green;
		apply = GUILayout.Button ("Apply", GUILayout.Width(200));
		GUI.color = Color.white;
		EditorGUI.EndDisabledGroup ();
		GUILayout.EndHorizontal ();

		GUILayout.BeginHorizontal ();
		EditorGUI.BeginDisabledGroup (m_Asset != null);
		GUI.color = Color.red;
		removeAll = GUILayout.Button ("Remove All", GUILayout.Width(200));
		GUI.color = Color.white;
		EditorGUI.EndDisabledGroup ();

		EditorGUI.BeginDisabledGroup (m_Asset != null);
		GUI.color = Color.red;
		remove = GUILayout.Button ("Remove", GUILayout.Width(200));
		GUI.color = Color.white;
		EditorGUI.EndDisabledGroup ();

		GUILayout.EndHorizontal ();
	
		if(applyToAll)
		{
			ApplyToAll();
		}

		if(apply)
		{
			Apply();
		}

		if(removeAll)
		{
			RemoveAll();
		}

		if(remove)
		{
			Remove();
		}

		if(m_Buttons.Count > 0)
		{
			DrawButtonsNames();
		}
	}
Example #42
0
 public static void OneShot(FMODAsset asset_)
 {
     FMOD_StudioSystem.instance.PlayOneShot(asset_, new Vector3(0,0,0));
 }