public void ChangeSound(StudioEventEmitter emit) { if (current != emit) { if (current != null) { current.Stop(); } current = emit; current.Play(); } }
// Update is called once per frame private void Update() { if (CurrentSeason != 3) { if (GrassColorNormal != GrassMaterial.color || LeavesColorNormal != LeavesMaterial.color) { float seasonBegin = (Time.time - _gameStart) / SeasonDuration; seasonBegin = Mathf.Min(1f, (seasonBegin - (int)seasonBegin) * 5f); if (GrassColorNormal != GrassMaterial.color) { GrassMaterial.color = Color.Lerp(GrassColorWinter, GrassColorNormal, seasonBegin); } if (LeavesColorNormal != LeavesMaterial.color) { LeavesMaterial.color = Color.Lerp(LeavesColorWinter, LeavesColorNormal, seasonBegin); } } } else { if (GrassColorWinter != GrassMaterial.color || LeavesColorWinter != LeavesMaterial.color) { float seasonBegin = (Time.time - _gameStart) / SeasonDuration; seasonBegin = Mathf.Min(1f, (seasonBegin - (int)seasonBegin) * 5f); if (GrassColorWinter != GrassMaterial.color) { GrassMaterial.color = Color.Lerp(GrassColorNormal, GrassColorWinter, seasonBegin); } if (LeavesColorWinter != LeavesMaterial.color) { LeavesMaterial.color = Color.Lerp(LeavesColorNormal, LeavesColorWinter, seasonBegin); } } } StudioEventEmitter fmodEmitter = GameObject.Find("Main Camera").GetComponent <StudioEventEmitter>(); // Winter float param = (Time.time - _gameStart) / (SeasonDuration * 4f); param = param - (int)param; fmodEmitter.EventInstance.setParameterValue("Winter", _toWinterParameter(param)); // Selector param = (Time.realtimeSinceStartup - _gameStart) / 50f; param = param - (int)param; if (param < 0.25f) { param = 0.5f - param; } else if (param > 0.75f) { param = 1.5f - param; } fmodEmitter.EventInstance.setParameterValue("Selector", param); }
public static void ToggleEmitter(EmitterType emitterType) { StudioEventEmitter emitter = AudioManager.Instance.EventPaths.GetEmitter(emitterType); if (emitter.IsPlaying()) { emitter.Stop(); return; } emitter.Play(); }
private void Awake() { if (emitter == null) { emitter = GetComponent <StudioEventEmitter>(); } if (emitter == null) { Debug.LogError("No StudioEventEmitter found"); } }
private void Awake() { eventEmitter = GetComponent <StudioEventEmitter>(); Signals.Get(out playerEnergyLevelChangedSignal); Signals.Get(out victorySignal); Signals.Get(out gameSceneSignal); Signals.Get(out menuSceneSignal); playerEnergyLevelChangedSignal.AddListener(OnEnergyLevelChanged); victorySignal.AddListener(OnVictory); gameSceneSignal.AddListener(OnSceneReload); menuSceneSignal.AddListener(OnSceneReload); }
private void RegisterStudioEventEmitter(StudioEventEmitter[] studioEventEmitter) { m_PlayerOneStudioEventEmitter = studioEventEmitter[0]; m_PlayerOneStudioEventEmitter.OverrideAttenuation = true; m_PlayerOneStudioEventEmitter.OverrideMaxDistance = 100.0f; m_PlayerTwoStudioEventEmitter = studioEventEmitter[1]; m_PlayerTwoStudioEventEmitter.OverrideAttenuation = true; m_PlayerTwoStudioEventEmitter.OverrideMaxDistance = 100.0f; m_TriggerStudioEventEmitter = studioEventEmitter[2]; m_TriggerStudioEventEmitter.OverrideAttenuation = true; m_TriggerStudioEventEmitter.OverrideMaxDistance = 100.0f; }
void InstanciateSound(string eventName, float delay, float volume, bool loop, Vector3 pos, Vector3 endPos, float tweenDuration = 2) { GameObject newGO = new GameObject(eventName + "Emitter") as GameObject;//Instantiate(prefabEmitter, pos, Quaternion.identity) as GameObject; newGO.transform.position = pos; StudioEventEmitter newEmitter = newGO.AddComponent <StudioEventEmitter>() as StudioEventEmitter; if (endPos != Vector3.zero) { newGO.transform.DOMove(endPos, tweenDuration); } newEmitter.Event = eventName; newEmitter.Play(); }
void PlayTown(StudioEventEmitter emitter, bool isInTown) { if (isInTown) { _inTown = true; _inForest = false; PlayOnTown(null); } else { _inTown = false; emitter.Stop(); } }
void Start() { _texts = Texts.GetComponentsInChildren <TextMeshProUGUI>(); emitter = GetComponent <StudioEventEmitter>(); // PlayerPrefs.SetInt("Score", ScoreTest); scoreNumberText.text = PlayerPrefs.GetInt("Score").ToString(); rank = Mathf.Clamp((PlayerPrefs.GetInt("Score") / 100), 0, 9); StartCoroutine(goRanking(timerForAnimation)); UnityEngine.Debug.Log(rank); }
void Awake() { cam = GetComponent <CinemachineVirtualCamera>(); emitter = transform.parent.gameObject.GetComponent <StudioEventEmitter>(); if (emitter == null) { emitter = transform.parent.gameObject.AddComponent <StudioEventEmitter>(); } emitter.Event = FModStrings.Music; if (!emitter.IsPlaying()) { emitter.Play(); } }
void Start() { if (emitter == null) { emitter = GetComponent <StudioEventEmitter>(); } RESULT result = RESULT.OK; result = emitter.EventInstance.getParameter(occlusionParameter, out parameter); if (result == RESULT.OK) { hasParameter = true; } }
protected void Awake() { var angles = transform.eulerAngles; x = angles.y; z = angles.x; _fmodEmitter = GetComponent <StudioEventEmitter>(); _fmodListener = GetComponent <StudioListener>(); _transform = transform; if (_transform.GetComponentInChildren <Animator>() != null) { _animator = _transform.GetComponentInChildren <Animator>(); } }
public void Init(MonoGameManager manager) { _gameManager = manager; Instance = this; _finalSound = gameObject.AddComponent <StudioEventEmitter>(); _finalSound.Event = "event:/vr_boot"; itemRegistry = new ItemRegistry(); foreach (var item in allItemConfig.items) { itemRegistry.Add(item); } AllItems.Init(itemRegistry); }
// Start is called before the first frame update void Start() { playerInput = this.GetComponent <PlayerInput>(); playerEffects = this.GetComponent <PlayerEffects>(); _throw = this.GetComponent <Throw>(); potionVariants = GameController.Instance.potionVariants; soundscape = null; GameObject go = GameObject.Find("trilha"); paramValue = 1.0f; playedFullBarSound = false; if (go != null) { soundscape = go.GetComponent <StudioEventEmitter>(); } }
protected override void Start() { if (!AudioManager.IsInitialized) { return; } wind = AudioPlayer.GetEventInstance(EventType.SFX_DISASTER_WindBlowing); rain = AudioPlayer.GetEventInstance(EventType.SFX_DISASTER_HeavyRain); rainWind = AudioPlayer.GetEventInstance(EventType.SFX_DISASTER_RainAndWind); earthQuake = AudioPlayer.GetEventInstance(EventType.SFX_DISASTER_Earthquake); backgroundEmitter = AudioManager.Instance.EventPaths.GetEmitter(EmitterType.BackgroundMusic); base.Start(); }
private void Awake() { if (_instance != null && _instance != this) { Destroy(this.gameObject); } else { _instance = this; } DontDestroyOnLoad(gameObject); emitter = GetComponent <StudioEventEmitter>(); audioSource = GetComponent <AudioSource>(); InitPlayer(); }
#pragma warning restore 0649 #region Setup and Navigation. // Animates in the canvas and sets up the values. private void Awake() { eventEmitter = GetComponentInChildren <StudioEventEmitter>(); canvasGroup = GetComponent <CanvasGroup>(); canvasGroup.alpha = 0f; GameMaster.Instance.GameState = ExecutionState.PopupPause; store = FindObjectOfType <StoreController>(); waitFrame = new WaitForEndOfFrame(); waitForItem = new WaitForSeconds(itemInAnimationDuration); waitForStats = new WaitForSeconds(statsAnimationDuration); waitForLetters = new WaitForSeconds(statsAnimationDuration * 0.1f); DOTween.To(() => canvasGroup.alpha, x => canvasGroup.alpha = x, 1f, popInAnimationDuration).onComplete = () => { StartCoroutine(nameof(FillItemSlots)); }; }
#pragma warning restore 0649 #region Setup and Navigation. // Animates in the canvas and sets up the values. private void Awake() { eventEmitter = GetComponentInChildren <StudioEventEmitter>(); canvasGroup = GetComponent <CanvasGroup>(); canvasGroup.alpha = 0f; GameMaster.Instance.GameState = ExecutionState.PopupPause; upgradeSettings = Resources.Load <PlayerUpgradeSettings>(upgradeSettingsPath); waitFrame = new WaitForEndOfFrame(); waitForItem = new WaitForSeconds(itemInAnimationDuration); waitForStats = new WaitForSeconds(statsAnimationDuration); waitForLetters = new WaitForSeconds(statsAnimationDuration * 0.1f); DOTween.To(() => canvasGroup.alpha, x => canvasGroup.alpha = x, 1f, popinAnimationDuration).onComplete = () => { StartCoroutine(nameof(FillItemSlots)); }; }
private void Awake() { if (PlayerPrefs.GetInt("FmodOn") > 0) { fmodOn = true; } _emitter = GetComponent <StudioEventEmitter>(); if (fmodOn) { _emitter.SetParameter("speed", 0f); string movementPath = "event:/SFX/Player_movement"; if (FMOD_Debug.CheckFmodEvent(movementPath)) { _emitter.Event = movementPath; _emitter.Play(); } } }
protected void Awake() { sfx_PortalShot = GetComponent <StudioEventEmitter>(); _portalTarget = GetComponentInChildren <PortalTarget>(); var pos = _portalTarget.transform.position; pos.z = 0f; _portalTarget.transform.position = pos; _clawTarget = GetComponent <ClawTarget>(); if (_clawTarget == null) { Debug.LogError("Not a valid portal"); return; } _clawTarget.OnShipUnDocked += OnShipLeave; }
// Start is called before the first frame update void Start() { MasterBus = FMODUnity.RuntimeManager.GetBus("Bus:/"); vitoriaEmitter = null; GameObject go = GameObject.Find("vitoria"); if (go != null) { vitoriaEmitter = go.GetComponent <StudioEventEmitter>(); } ambientacaoEmitter = null; go = GameObject.Find("ambiencia"); if (go != null) { ambientacaoEmitter = go.GetComponent <StudioEventEmitter>(); } AlreadyEnded = false; this.gameObject.SetActive(false); }
protected virtual void Reset() { if (this._animator == null) { this._animator = this.GetComponentInChildren <Animator>(); } #if LUDIQ_CHRONOS if (this._timeline == null) { this._timeline = this.GetComponentInChildren <Timeline>(); } #endif #if FMOD if (this._mounthVoiceEmitter == null) { this._mounthVoiceEmitter = this.GetComponentInChildren <StudioEventEmitter>(); } #endif }
void Awake() { if (cameraText == null) { Debug.LogError("Missing reference to camera text UI"); } cam = GetComponent <CinemachineVirtualCamera>(); emitter = transform.parent.gameObject.GetComponent <StudioEventEmitter>(); if (emitter == null) { emitter = transform.parent.gameObject.AddComponent <StudioEventEmitter>(); } emitter.Event = FModStrings.Music; if (!emitter.IsPlaying()) { emitter.Play(); } }
// Use this for initialization void Start() { SE = GetComponent <StudioEventEmitter>(); animator = this.GetComponent <Animator>(); gun = this.transform.GetComponentInChildren <Gun>(); aiVision = this.transform.GetComponentInChildren <AIVision>(); ai = this.GetComponent <AI>(); levelGenerator = GameObject.Find("LevelGenerator").GetComponent <LevelGenerator>(); ai.target = GameObject.FindWithTag("Player").transform; startIdleTime = idleTime; startPatrolTime = patrolTime; if (gameObject.tag == "Enemy") { Decision(); } }
void Start() { _sounds = new [] { SmallPetSound, MediumPetSound, LargePetSound }; Vector3 petScale = transform.localScale; if (petScale.x == 0.5f) { _currentSound = SmallPetSound; } else if (petScale.x == 1f) { _currentSound = MediumPetSound; } else if (petScale.x == 1.5) { _currentSound = LargePetSound; } ResetInterval(); }
public static void _playSoundDo(string eventName, GameObject voicer = null) { StudioEventEmitter studioEvent = null; if (!voicer) { var eventNameGo = eventName.Replace('/', '_'); studioEvent = _root.FindChild <StudioEventEmitter>(eventNameGo, false); if (!studioEvent) { var go = new GameObject(eventNameGo); go.name = eventNameGo; go.transform.SetParent(_root.transform); go.transform.localPosition = Vector3.zero; studioEvent = go.GetMissComponent <StudioEventEmitter>(); studioEvent.OverrideAttenuation = true; studioEvent.OverrideMaxDistance = int.MaxValue; studioEvent.OverrideMinDistance = int.MaxValue; studioEvent.SetVolume(Volume_Music); } } else { studioEvent = voicer.GetMissComponent <StudioEventEmitter>(); if (studioEvent.IsPlaying()) { studioEvent.Stop(); } studioEvent.OverrideAttenuation = true; studioEvent.OverrideMaxDistance = 20; studioEvent.OverrideMinDistance = 3; studioEvent.SetVolume(Volume_Music); if (!_3dstudioEventList.Contains(studioEvent)) { _3dstudioEventList.Add(studioEvent); } } studioEvent.Event = eventName; studioEvent.Play(); }
void InstanciateSound(string eventName, float delay, float volume, int intBoolLoop, Vector3 pos, Vector3 endPos, float tweenDuration = 2) { GameObject newGO = new GameObject(eventName + "Emitter") as GameObject;//Instantiate(prefabEmitter, pos, Quaternion.identity) as GameObject; newGO.transform.position = pos; StudioEventEmitter newEmitter = newGO.AddComponent <StudioEventEmitter>() as StudioEventEmitter; newEmitter.Event = eventName; newEmitter.SetParameter("Volume", volume); if (intBoolLoop == 0) { } if (endPos != Vector3.zero) { StartCoroutine(SoundCouroutine(newEmitter, delay, Vector3.zero, tweenDuration)); } else { StartCoroutine(SoundCouroutine(newEmitter, delay, Vector3.zero, tweenDuration)); } }
private void Awake() { if (Current == null) { Current = this; DontDestroyOnLoad(gameObject); if (TryGetComponent(out emitter) == false) { emitter = gameObject.AddComponent <StudioEventEmitter>(); emitter.Event = musicEventPath; } if (playOnAwake) { Play(); } } else { DestroyImmediate(gameObject); } }
static bool Prefix(Raft __instance, ref Rigidbody ___body, ref float ___speed, ref StudioEventEmitter ___eventEmitter_idle, ref Vector3 ___previousPosition) { if (!Semih_Network.IsHost) { return(false); } if (!__instance.IsAnchored && ___speed != 0f) { __instance.moveDirection = Vector3.forward; List <Sail> allSails = Sail.AllSails; Vector3 vector = Vector3.zero; int i = 0; int num = 1; while (i < allSails.Count) { Sail sail = allSails[i]; if (sail.open) { vector += sail.GetNormalizedDirection() * (float)(num / Math.Pow(num, rate)); } i++; num++; } if (vector.z < 0f) { vector.z = ((Mathf.Abs(vector.x) <= 0.7) ? -0.8f : (__instance.moveDirection.z = 0f)); } __instance.moveDirection += vector; ___body.AddForce(__instance.moveDirection * ___speed); } if (___body.velocity.sqrMagnitude > __instance.maxVelocity) { ___body.velocity = Vector3.ClampMagnitude(___body.velocity, __instance.maxVelocity); } ___eventEmitter_idle.SetParameter("velocity", ___body.velocity.sqrMagnitude / __instance.maxVelocity); ___previousPosition = ___body.transform.position; return(false); }
// Update is called once per frame private void Update() { if (!Initialized && _densityCounter++ > Density.StepThreshold) { Initialized = true; Density[] density = GameObject.Find("Ground").GetComponentsInChildren <Density> (); float[] ratios = new float [density.Length]; for (int i = 0; i < density.Length; i++) { ratios [i] = ( density [i].WaterDistance <= Manager.Instance.MinimumWaterDistance || density [i].TreeDistance <= Manager.Instance.MinimumForestDistance || density [i].StoneDistance <= Manager.Instance.MinimumStoneDistance || density [i].IronDistance <= Manager.Instance.MinimumIronDistance) ? 0f : ( 0.3f * density [i].WaterDensity + 0.3f * density [i].TreeDensity + 0.2f * density [i].StoneDensity + 0.2f * density [i].IronDensity ); } Center = density [Array.IndexOf(ratios, Mathf.Max(ratios))].transform.position; //Debug.Log ("Placement du village en " + Center); PlaceVillage(); } if (Initialized) { StudioEventEmitter fmodEmitter = GameObject.Find("Main Camera").GetComponent <StudioEventEmitter>(); if (_villagers.Count <= 3) { fmodEmitter.EventInstance.setParameterValue("GameOver", 0.7f + (Manager.Instance.CurrentSeason * 0.2f / 3f) + (3 - _villagers.Count) * 0.2f); } else { fmodEmitter.EventInstance.setParameterValue("GameOver", 0f); } } }