void Start() { dfUnity = DaggerfallUnity.Instance; songPlayer = GetComponent <DaggerfallSongPlayer>(); // Get local player GPS if not set if (LocalPlayerGPS == null) { LocalPlayerGPS = GameManager.Instance.PlayerGPS; } // Get player entity if (playerEntity == null) { playerEntity = GameManager.Instance.PlayerEntity; } // Get streaming world if not set if (StreamingWorld == null) { StreamingWorld = GameManager.Instance.StreamingWorld; } // Get required player components if (LocalPlayerGPS) { playerEnterExit = LocalPlayerGPS.GetComponent <PlayerEnterExit>(); playerWeather = LocalPlayerGPS.GetComponent <PlayerWeather>(); } }
/// <summary> /// Sets NPC information available at instantiation time. /// NPCs are only instantiated when player enters their context and layout places them in world. /// So a lot can be derived just from player behaviours. /// </summary> void SetRuntimeData() { // Get reference to player objects holding world information PlayerEnterExit playerEnterExit = GameManager.Instance.PlayerEnterExit; PlayerGPS playerGPS = GameManager.Instance.PlayerGPS; // Store map ID npcData.mapID = playerGPS.CurrentMapID; // Store location ID (if any - not all locations carry a unique ID) npcData.locationID = (int)playerGPS.CurrentLocation.Exterior.ExteriorData.LocationId; // Store building key if player inside a building // This can be gleaned from any exterior door if one is available npcData.buildingKey = 0; if (playerEnterExit.IsPlayerInsideBuilding) { if (playerEnterExit.ExteriorDoors != null && playerEnterExit.ExteriorDoors.Length > 0) { npcData.buildingKey = playerEnterExit.ExteriorDoors[0].buildingKey; } } // Store name bank npcData.nameBank = GameManager.Instance.PlayerGPS.GetNameBankOfCurrentRegion(); }
void Start() { if (playerEnterExit == null) playerEnterExit = GameManager.Instance.PlayerEnterExit; if (mainCamera == null) mainCamera = GameManager.Instance.MainCamera; }
void Start() { dfUnity = DaggerfallUnity.Instance; songPlayer = GetComponent <DaggerfallSongPlayer>(); // Get local player GPS if not set if (LocalPlayerGPS == null) { LocalPlayerGPS = GameManager.Instance.PlayerGPS; } // Get streaming world if not set if (StreamingWorld == null) { StreamingWorld = GameManager.Instance.StreamingWorld; } // Get required player components if (LocalPlayerGPS) { playerEnterExit = LocalPlayerGPS.GetComponent <PlayerEnterExit>(); playerWeather = LocalPlayerGPS.GetComponent <PlayerWeather>(); } // Shuffle song on load or fast travel StreamingWorld.OnInitWorld += StreamingWorld_OnInitWorld; }
void Start() { dfUnity = DaggerfallUnity.Instance; songPlayer = GetComponent <DaggerfallSongPlayer>(); // Get local player GPS if not set if (LocalPlayerGPS == null) { LocalPlayerGPS = GameManager.Instance.PlayerGPS; } // Get player entity if (playerEntity == null) { playerEntity = GameManager.Instance.PlayerEntity; } // Get streaming world if not set if (StreamingWorld == null) { StreamingWorld = GameManager.Instance.StreamingWorld; } // Get required player components if (LocalPlayerGPS) { playerEnterExit = LocalPlayerGPS.GetComponent <PlayerEnterExit>(); playerWeather = LocalPlayerGPS.GetComponent <PlayerWeather>(); } // Use alternate music if set if (DaggerfallUnity.Settings.AlternateMusic) { DungeonInteriorSongs = _dungeonSongsFM; SunnySongs = _sunnySongsFM; CloudySongs = _cloudySongsFM; OvercastSongs = _overcastSongsFM; RainSongs = _weatherRainSongsFM; SnowSongs = _weatherSnowSongsFM; TempleSongs = _templeSongsFM; TavernSongs = new SongFiles[_tavernSongs.Length + _tavernSongsFM.Length]; Array.Copy(_tavernSongs, TavernSongs, _tavernSongs.Length); Array.Copy(_tavernSongsFM, 0, TavernSongs, _tavernSongs.Length, _tavernSongsFM.Length); NightSongs = _nightSongsFM; ShopSongs = _shopSongsFM; MagesGuildSongs = _magesGuildSongsFM; InteriorSongs = _interiorSongsFM; PalaceSongs = _palaceSongsFM; CastleSongs = _castleSongsFM; CourtSongs = _courtSongsFM; SneakingSongs = _sneakingSongsFM; } PlayerEnterExit.OnTransitionDungeonInterior += PlayerEnterExit_OnTransitionDungeonInterior; PlayerEnterExit.OnTransitionInterior += PlayerEnterExit_OnTransitionInterior; }
void Start() { player = GameManager.Instance.PlayerEntity; playerMotor = GetComponent <PlayerMotor>(); levitateMotor = GetComponent <LevitateMotor>(); controller = GetComponent <CharacterController>(); playerEnterExit = GetComponent <PlayerEnterExit>(); acrobatMotor = GetComponent <AcrobatMotor>(); }
void Start() { random = new System.Random(System.DateTime.Now.Millisecond); dfAudioSource = GetComponent <DaggerfallAudioSource>(); dfAudioSource.Preset = AudioPresets.OnDemand; ApplyPresets(); StartWaiting(); playerBehaviour = GameManager.Instance.PlayerEntityBehaviour; playerEnterExit = GameManager.Instance.PlayerEnterExit; }
void Start() { playerMotor = GetComponent <PlayerMotor>(); playerEnterExit = GetComponent <PlayerEnterExit>(); climbingMotor = GetComponent <ClimbingMotor>(); mainCamera = GameManager.Instance.MainCamera; restPos = mainCamera.transform.localPosition; bobSpeed = GetComponent <PlayerFootsteps>().WalkStepInterval / 2.0f; // 1.20f; bIsStopping = false; }
void Start() { player = GameManager.Instance.PlayerEntity; playerMotor = GetComponent <PlayerMotor>(); groundMotor = GetComponent <PlayerGroundMotor>(); levitateMotor = GetComponent <LevitateMotor>(); controller = GetComponent <CharacterController>(); playerEnterExit = GetComponent <PlayerEnterExit>(); acrobatMotor = GetComponent <AcrobatMotor>(); speedChanger = GetComponent <PlayerSpeedChanger>(); stepDetector = GetComponent <PlayerStepDetector>(); }
void Start() { playerGPS = GetComponent <PlayerGPS>(); playerEnterExit = GetComponent <PlayerEnterExit>(); if (RainParticles) { RainParticles.SetActive(false); } if (SnowParticles) { SnowParticles.SetActive(false); } }
void Start() { dfUnity = DaggerfallUnity.Instance; playerEnterExit = GetComponent <PlayerEnterExit>(); if (PlayerTorch) { torchLight = PlayerTorch.GetComponent <Light>(); if (torchLight) { torchIntensity = torchLight.intensity; } } }
private void PlayEffects() { // Do nothing if audio not setup if (ambientAudioSource == null || ambientSounds == null) { return; } // Get next sound index int index = random.Next(0, ambientSounds.Length); // Play effect if (Presets == AmbientSoundPresets.Storm) { if (PlayLightningEffect) { // Play lightning effects together with appropriate sounds StartCoroutine(PlayLightningEffects(index)); } else { // Play ambient sound as a one-shot 3D sound SoundClips clip = ambientSounds[index]; PlaySomewhereOnHorizon(clip, 1f); // AmbientPlayOneShot(clip, 5f); RaiseOnPlayEffectEvent(clip); } } else { // Do not play ambient effect in castle blocks if (doNotPlayInCastle) { if (playerEnterExit == null) { playerEnterExit = GameManager.Instance.PlayerEnterExit; } if (playerEnterExit && playerEnterExit.IsPlayerInsideDungeonCastle) { return; } } // Play ambient sound as a one-shot 3D sound SoundClips clip = ambientSounds[index]; PlaySomewhereAround(clip, 1f); RaiseOnPlayEffectEvent(clip); } }
void Start() { player = GameManager.Instance.PlayerEntity; playerMotor = GetComponent <PlayerMotor>(); //groundMotor = GetComponent<PlayerGroundMotor>(); levitateMotor = GetComponent <LevitateMotor>(); controller = GetComponent <CharacterController>(); playerEnterExit = GetComponent <PlayerEnterExit>(); acrobatMotor = GetComponent <AcrobatMotor>(); speedChanger = GetComponent <PlayerSpeedChanger>(); rappelMotor = GetComponent <RappelMotor>(); //hangingMotor = GetComponent<HangingMotor>(); moveScanner = GetComponent <PlayerMoveScanner>(); }
// Use this for initialization void Start() { // Disable self if mod not enabled if (!DaggerfallUnity.Settings.UncannyValley_BirdsInDaggerfall) { gameObject.SetActive(false); return; } birdSpawn = new GameObject[9]; mainCamera = GameObject.FindGameObjectWithTag("MainCamera"); playerEnterExit = GameManager.Instance.PlayerEnterExit; StartCoroutine("SpawnBirds"); }
void Start() { PlayerGps = GetComponent <PlayerGPS>(); playerEnterExit = GetComponent <PlayerEnterExit>(); if (RainParticles) { RainParticles.SetActive(false); } if (SnowParticles) { SnowParticles.SetActive(false); } ClimateWeathers = new byte[6]; }
void Start() { random = new System.Random(System.DateTime.Now.Millisecond); dfAudioSource = GetComponent <DaggerfallAudioSource>(); loopAudioSource = GetNewAudioSource(); ambientAudioSource = GetNewAudioSource(); ApplyPresets(); StartWaiting(); playerBehaviour = GameManager.Instance.PlayerEntityBehaviour; playerEnterExit = GameManager.Instance.PlayerEnterExit; DaggerfallVidPlayerWindow.OnVideoStart += AmbientEffectsPlayer_OnVideoStart; DaggerfallVidPlayerWindow.OnVideoEnd += AmbientEffectsPlayer_OnVideoEnd; }
void Start() { controller = GetComponent <CharacterController>(); speedChanger = GetComponent <PlayerSpeedChanger>(); speed = speedChanger.GetBaseSpeed(); groundMotor = GetComponent <PlayerGroundMotor>(); climbingMotor = GetComponent <ClimbingMotor>(); heightChanger = GetComponent <PlayerHeightChanger>(); levitateMotor = GetComponent <LevitateMotor>(); frictionMotor = GetComponent <FrictionMotor>(); acrobatMotor = GetComponent <AcrobatMotor>(); playerEnterExit = GameManager.Instance.PlayerEnterExit; // Allow for resetting specific player state on new game or when game starts loading SaveLoadManager.OnStartLoad += SaveLoadManager_OnStartLoad; StartGameBehaviour.OnNewGame += StartGameBehaviour_OnNewGame; }
//PlayerMotor playerMotor; //PlayerMouseLook playerMouseLook; //ShowTitleScreen titleScreen; //int timeScaleControl = 1; //int minTimeScaleControl = 1; //int maxTimeScaleControl = 150; //int timeScaleStep = 25; //float timeScaleMultiplier = 10f; //float startRunSpeed; //float startTorchRange; //bool showDebugStrings = false; //bool invertMouse = false; //bool hiRunSpeed = false; //bool hiTorchRange = false; void Start() { dfUnity = DaggerfallUnity.Instance; streamingWorld = GameObject.FindObjectOfType <StreamingWorld>(); playerEnterExit = GetComponent <PlayerEnterExit>(); playerGPS = GetComponent <PlayerGPS>(); //playerMotor = GetComponent<PlayerMotor>(); //playerMouseLook = GameObject.FindObjectOfType<PlayerMouseLook>(); //titleScreen = GameObject.FindObjectOfType<ShowTitleScreen>(); //// Get starting run speed //if (playerMotor) // startRunSpeed = playerMotor.runSpeed; //// Get starting torch range //if (PlayerTorch != null) // startTorchRange = PlayerTorch.range; }
void Start() { dfUnity = DaggerfallUnity.Instance; playerEnterExit = GetComponent <PlayerEnterExit>(); playerEntity = GameManager.Instance.PlayerEntity; if (PlayerTorch) { torchLight = PlayerTorch.GetComponent <Light>(); if (torchLight) { torchIntensity = torchLight.intensity; if (DaggerfallUnity.Settings.PlayerTorchFromItems) { torchLight.shadows = LightShadows.Soft; } } } }
void Start() { dfUnity = DaggerfallUnity.Instance; playerEnterExit = GetComponent <PlayerEnterExit>(); playerEntity = GameManager.Instance.PlayerEntity; if (PlayerTorch) { torchLight = PlayerTorch.GetComponent <Light>(); if (torchLight) { torchIntensity = torchLight.intensity; if (DaggerfallUnity.Settings.PlayerTorchFromItems) { torchLight.shadows = LightShadows.Soft; torchLight.transform.position = new Vector3(-0.3f, 1.2f, 0.2f); } } } }
void Start() { dfUnity = DaggerfallUnity.Instance; songPlayer = GetComponent <DaggerfallSongPlayer>(); // Try to find local player GPS if not set if (LocalPlayerGPS == null) { GameObject player = GameObject.FindGameObjectWithTag("Player"); if (player) { LocalPlayerGPS = player.GetComponent <PlayerGPS>(); } } // Get required player components if (LocalPlayerGPS) { playerEnterExit = LocalPlayerGPS.GetComponent <PlayerEnterExit>(); playerWeather = LocalPlayerGPS.GetComponent <PlayerWeather>(); } }
private void PlayEffects() { // Do nothing if audio not setup if (dfAudioSource == null || ambientSounds == null) { return; } // Get next sound index int index = random.Next(0, ambientSounds.Length); // Play effect if (Presets == AmbientSoundPresets.Storm && PlayLightningEffect) { // Play lightning effects together with appropriate sounds StartCoroutine(PlayLightningEffects(index)); } else { // Do not play ambient effect in palace blocks if (doNotPlayInPalace) { PlayerEnterExit playerEnterExit = GameManager.Instance.PlayerEnterExit; if (playerEnterExit) { if (playerEnterExit.IsPlayerInsideDungeonPalace) { return; } } } // Play ambient sound as a one-shot 2D sound SoundClips clip = ambientSounds[index]; dfAudioSource.PlayOneShot((int)clip, 0); RaiseOnPlayEffectEvent(clip); } }
void Start() { // Store references dfUnity = DaggerfallUnity.Instance; dfAudioSource = GetComponent <DaggerfallAudioSource>(); playerMotor = GetComponent <PlayerMotor>(); playerEnterExit = GetComponent <PlayerEnterExit>(); // Add our own custom audio source at runtime as we need to change the pitch of footsteps. // We don't want that affecting to other sounds on this game object. customAudioSource = gameObject.AddComponent <AudioSource>(); customAudioSource.hideFlags = HideFlags.HideInInspector; customAudioSource.playOnAwake = false; customAudioSource.loop = false; customAudioSource.dopplerLevel = 0f; customAudioSource.spatialBlend = 0f; // Set start position lastPosition = GetHorizontalPosition(); // Set starting footsteps currentFootstepSound = FootstepSoundNormal; }
void Start() { // Store references dfUnity = DaggerfallUnity.Instance; dfAudioSource = GetComponent <DaggerfallAudioSource>(); playerMotor = GetComponent <PlayerMotor>(); playerEnterExit = GetComponent <PlayerEnterExit>(); transportManager = GetComponent <TransportManager>(); // CustomAudioSource was here for adjusting pitch. It should be removable now, but doing so makes the swimming sound loud, so leaving it for now. customAudioSource = gameObject.AddComponent <AudioSource>(); customAudioSource.hideFlags = HideFlags.HideInInspector; customAudioSource.playOnAwake = false; customAudioSource.loop = false; customAudioSource.dopplerLevel = 0f; customAudioSource.spatialBlend = 0f; // Set start position lastPosition = GetHorizontalPosition(); // Set starting footsteps currentFootstepSound1 = FootstepSoundDungeon1; currentFootstepSound2 = FootstepSoundDungeon2; }
private void OnTransitionToDungeonInterior(PlayerEnterExit.TransitionEventArgs args) { InitWhenInInteriorOrDungeon(null, false); }
void Start() { playerEnterExit = GetComponent<PlayerEnterExit>(); StartCoroutine(ManageAmbientLight()); }
void OnTransitionToExterior(PlayerEnterExit.TransitionEventArgs args) { LayerMask layerIndexWorldTerrain = LayerMask.NameToLayer("WorldTerrain"); if (layerIndexWorldTerrain != -1) { mirrorRefl.m_ReflectLayers.value = (1 << LayerMask.NameToLayer("Default")) + (1 << LayerMask.NameToLayer("WorldTerrain")); mirrorReflSeaLevel.m_ReflectLayers = (1 << LayerMask.NameToLayer("Default")) + (1 << LayerMask.NameToLayer("WorldTerrain")); } else { mirrorRefl.m_ReflectLayers.value = 1 << LayerMask.NameToLayer("Default"); mirrorReflSeaLevel.m_ReflectLayers = 1 << LayerMask.NameToLayer("Default"); } mirrorRefl.CurrentBackgroundSettings = MirrorReflection.EnvironmentSetting.OutdoorSetting; mirrorReflSeaLevel.CurrentBackgroundSettings = MirrorReflection.EnvironmentSetting.OutdoorSetting; }
void Start() { playerEnterExit = GetComponent <PlayerEnterExit>(); StartCoroutine(ManageAmbientLight()); }
private void OnTransitionToInterior(PlayerEnterExit.TransitionEventArgs args) { InitWhenInInteriorOrDungeon(args.StaticDoor); }
void Start() { playerGPS = GetComponent <PlayerGPS>(); playerEnterExit = GetComponent <PlayerEnterExit>(); mainCamera = GameObject.FindGameObjectWithTag("MainCamera"); }
void Start() { playerGPS = GetComponent<PlayerGPS>(); playerEnterExit = GetComponent<PlayerEnterExit>(); if (RainParticles) RainParticles.SetActive(false); if (SnowParticles) SnowParticles.SetActive(false); }
//player transitioned to exterior from indoors or dungeon /// <summary> /// Get ExteriorTransition & DungeonExteriorTransition events from PlayerEnterExit /// </summary> /// <param name="args"></param> public void ExteriorTransitionEvent(PlayerEnterExit.TransitionEventArgs args) { _stopWatch.Stop(); TimeInside = _stopWatch.Elapsed.Minutes; if(EnhancedSkyCurrentToggle) ToggleSkyObjects(true); //enable sky objects }
//player went indoors (or dungeon), disable sky objects /// <summary> /// Get InteriorTransition & InteriorDungeonTransition events from PlayerEnterExit /// </summary> /// <param name="args"></param> public void InteriorTransitionEvent(PlayerEnterExit.TransitionEventArgs args) { _stopWatch.Reset(); _stopWatch.Start(); }
void OnTransitionToInterior(PlayerEnterExit.TransitionEventArgs args) { mirrorRefl.m_ReflectLayers.value = 1 << LayerMask.NameToLayer("Default"); mirrorReflSeaLevel.m_ReflectLayers = 1 << LayerMask.NameToLayer("Default"); mirrorRefl.CurrentBackgroundSettings = MirrorReflection.EnvironmentSetting.IndoorSetting; mirrorReflSeaLevel.CurrentBackgroundSettings = MirrorReflection.EnvironmentSetting.IndoorSetting; }
private void PlayEffects() { // Do nothing if audio not setup if (dfAudioSource == null || ambientSounds == null) { return; } // Get next sound index int index = random.Next(0, ambientSounds.Length); // Play effect if (Presets == AmbientSoundPresets.Storm && PlayLightningEffect) { // Play lightning effects together with appropriate sounds StartCoroutine(PlayLightningEffects(index)); } else { // Do not play ambient effect in castle blocks if (doNotPlayInCastle) { if (playerEnterExit == null) { playerEnterExit = GameManager.Instance.PlayerEnterExit; } if (playerEnterExit && playerEnterExit.IsPlayerInsideDungeonCastle) { return; } } // Play ambient sound as a one-shot 3D sound SoundClips clip = ambientSounds[index]; Vector3 randomPos = playerBehaviour.transform.position; bool positiveChange = Random.Range(0, 1) == 0; if (positiveChange) { randomPos.x += 3; } else { randomPos.x += -3; } positiveChange = Random.Range(0, 1) == 0; if (positiveChange) { randomPos.y += 3; } else { randomPos.y += -3; } positiveChange = Random.Range(0, 1) == 0; if (positiveChange) { randomPos.z += 3; } else { randomPos.z += -3; } dfAudioSource.transform.position = randomPos; dfAudioSource.PlayOneShot((int)clip, 1, 5f); RaiseOnPlayEffectEvent(clip); } }
private void OnTransitionToExterior(PlayerEnterExit.TransitionEventArgs args) { saveStateAutomapInterior(); DestroyBeacons(); }
void Start() { playerEnterExit = GetComponent <PlayerEnterExit>(); sunlightManager = GameManager.Instance.SunlightManager; StartCoroutine(ManageAmbientLight()); }
void Start() { dfUnity = DaggerfallUnity.Instance; playerEnterExit = GetComponent <PlayerEnterExit>(); }
//overloaded variant void InjectMaterialPropertiesOutdoor(PlayerEnterExit.TransitionEventArgs args) { InjectMaterialPropertiesOutdoor(); }
void Start() { dfUnity = DaggerfallUnity.Instance; songPlayer = GetComponent<DaggerfallSongPlayer>(); // Try to find local player GPS if not set if (LocalPlayerGPS == null) { GameObject player = GameObject.FindGameObjectWithTag("Player"); if (player) { LocalPlayerGPS = player.GetComponent<PlayerGPS>(); } } // Get required player components if (LocalPlayerGPS) { playerEnterExit = LocalPlayerGPS.GetComponent<PlayerEnterExit>(); playerWeather = LocalPlayerGPS.GetComponent<PlayerWeather>(); } }
void Start() { // Store references dfUnity = DaggerfallUnity.Instance; dfAudioSource = GetComponent<DaggerfallAudioSource>(); playerMotor = GetComponent<PlayerMotor>(); playerEnterExit = GetComponent<PlayerEnterExit>(); // Add our own custom audio source at runtime as we need to change the pitch of footsteps. // We don't want that affecting to other sounds on this game object. customAudioSource = gameObject.AddComponent<AudioSource>(); customAudioSource.hideFlags = HideFlags.HideInInspector; customAudioSource.playOnAwake = false; customAudioSource.loop = false; customAudioSource.dopplerLevel = 0f; customAudioSource.spatialBlend = 0f; // Set start position lastPosition = GetHorizontalPosition(); // Set starting footsteps currentFootstepSound = FootstepSoundNormal; }
//PlayerMotor playerMotor; //PlayerMouseLook playerMouseLook; //ShowTitleScreen titleScreen; //int timeScaleControl = 1; //int minTimeScaleControl = 1; //int maxTimeScaleControl = 150; //int timeScaleStep = 25; //float timeScaleMultiplier = 10f; //float startRunSpeed; //float startTorchRange; //bool showDebugStrings = false; //bool invertMouse = false; //bool hiRunSpeed = false; //bool hiTorchRange = false; void Start() { dfUnity = DaggerfallUnity.Instance; streamingWorld = GameObject.FindObjectOfType<StreamingWorld>(); playerEnterExit = GetComponent<PlayerEnterExit>(); playerGPS = GetComponent<PlayerGPS>(); //playerMotor = GetComponent<PlayerMotor>(); //playerMouseLook = GameObject.FindObjectOfType<PlayerMouseLook>(); //titleScreen = GameObject.FindObjectOfType<ShowTitleScreen>(); //// Get starting run speed //if (playerMotor) // startRunSpeed = playerMotor.runSpeed; //// Get starting torch range //if (PlayerTorch != null) // startTorchRange = PlayerTorch.range; }
void Start() { playerGPS = GetComponent<PlayerGPS>(); playerEnterExit = GetComponent<PlayerEnterExit>(); mainCamera = GameObject.FindGameObjectWithTag("MainCamera"); }
void Update() { // Change sound presets if (Presets != lastPresets) { // Clear settings lastPresets = Presets; rainLoop = null; cricketsLoop = null; // Stop playing any loops if (dfAudioSource.AudioSource.isPlaying) { dfAudioSource.AudioSource.Stop(); dfAudioSource.AudioSource.clip = null; dfAudioSource.AudioSource.loop = false; } ApplyPresets(); StartWaiting(); } // Start rain loop if not running if ((Presets == AmbientSoundPresets.Rain || Presets == AmbientSoundPresets.Storm) && rainLoop == null) { rainLoop = dfAudioSource.GetAudioClip((int)SoundClips.AmbientRaining); dfAudioSource.AudioSource.clip = rainLoop; dfAudioSource.AudioSource.loop = true; dfAudioSource.AudioSource.spatialBlend = 0; dfAudioSource.AudioSource.Play(); } // Start crickets loop if not running if ((Presets == AmbientSoundPresets.ClearNight) && cricketsLoop == null) { cricketsLoop = dfAudioSource.GetAudioClip((int)SoundClips.AmbientCrickets); dfAudioSource.AudioSource.clip = cricketsLoop; dfAudioSource.AudioSource.loop = true; dfAudioSource.AudioSource.spatialBlend = 0; dfAudioSource.AudioSource.Play(); } // Tick counters waitCounter += Time.deltaTime; waterWaitCounter += Time.deltaTime; if (waitCounter > waitTime) { PlayEffects(); StartWaiting(); } // Play water sound effects. Timing and position based on classic behavior. // TODO: Make sound follow player's X and Z movement but play from Y coordinate of dungeon water, for a more dynamically 3d sound. // Currently the sound is a volume adjustment based on vertical distance from the water. if (waterWaitCounter > waterSoundWaitTime) { if (playerEnterExit == null) { playerEnterExit = GameManager.Instance.PlayerEnterExit; } if (playerEnterExit) { if (playerEnterExit.blockWaterLevel != 10000) { Entity.DaggerfallEntityBehaviour player = GameManager.Instance.PlayerEntityBehaviour; // Chance to play gentle water sound based on vertical distance between player and water surface if (DFRandom.rand() < 50) { float waterHeightInDFUnityUnits = (playerEnterExit.blockWaterLevel * -1 * MeshReader.GlobalScale); float volumeScale = Mathf.Clamp(1 - (Mathf.Abs(player.transform.position.y - waterHeightInDFUnityUnits) / 9), 0, 1); dfAudioSource.PlayOneShot((int)SoundClips.WaterGentle, 0, volumeScale); } // Chance to play underwater bubbling noise if player is underwater if (playerEnterExit.IsPlayerSubmerged) { if (DFRandom.rand() < 100) { dfAudioSource.PlayOneShot((int)SoundClips.AmbientWaterBubbles, 0); } } } } waterWaitCounter = 0; } }
private bool GetRefrences() { try { if (!_depthMaskShader) _depthMaskShader = Resources.Load("DepthMask") as Shader; if (!_UnlitAlphaFadeShader) _UnlitAlphaFadeShader = Resources.Load("UnlitAlphaWithFade") as Shader; if (!StarMaskMat) StarMaskMat = new Material(_depthMaskShader); if (!_skyObjMat) _skyObjMat = new Material(_UnlitAlphaFadeShader); if (!StarsMat) StarsMat = Instantiate(Resources.Load("Stars")) as Material; if (!SkyMat) SkyMat = Instantiate(Resources.Load("Sky")) as Material; if (!_cloudGen) _cloudGen = this.GetComponent<CloudGenerator>(); if(!_cloudGen) _cloudGen = gameObject.AddComponent<CloudGenerator>(); if (!_containerPrefab) _containerPrefab = Resources.Load("EnhancedSkyContainer", typeof(GameObject)) as GameObject; if (!dfallSky) dfallSky = GameManager.Instance.SkyRig.gameObject; if (!playerEE) playerEE = GameManager.Instance.PlayerEnterExit; if (!exteriorParent) exteriorParent = GameManager.Instance.ExteriorParent; if (!weatherMan) weatherMan = GameManager.Instance.WeatherManager; } catch { DaggerfallUnity.LogMessage("Error in SkyManager.GetRefrences()", true); return false; } if (dfallSky && playerEE && exteriorParent && weatherMan && _cloudGen && _containerPrefab && _depthMaskShader && _UnlitAlphaFadeShader && StarMaskMat && _skyObjMat && StarsMat && SkyMat) return true; else return false; }
void OnTransitionToExterior(PlayerEnterExit.TransitionEventArgs args) { LayerMask layerIndexWorldTerrain = LayerMask.NameToLayer("WorldTerrain"); if (layerIndexWorldTerrain != -1) { mirrorRefl.m_ReflectLayers.value = (1 << LayerMask.NameToLayer("Default")) + (1 << LayerMask.NameToLayer("WorldTerrain")); mirrorReflSeaLevel.m_ReflectLayers = (1 << LayerMask.NameToLayer("Default")) + (1 << LayerMask.NameToLayer("WorldTerrain")); } else { mirrorRefl.m_ReflectLayers.value = 1 << LayerMask.NameToLayer("Default"); mirrorReflSeaLevel.m_ReflectLayers = 1 << LayerMask.NameToLayer("Default"); } }
void OnTransitionToInterior(PlayerEnterExit.TransitionEventArgs args) { mirrorRefl.m_ReflectLayers.value = 1 << LayerMask.NameToLayer("Default"); mirrorReflSeaLevel.m_ReflectLayers = 1 << LayerMask.NameToLayer("Default"); }
void Start() { dfUnity = DaggerfallUnity.Instance; songPlayer = GetComponent<DaggerfallSongPlayer>(); // Get local player GPS if not set if (LocalPlayerGPS == null) LocalPlayerGPS = GameManager.Instance.PlayerGPS; // Get streaming world if not set if (StreamingWorld == null) StreamingWorld = GameManager.Instance.StreamingWorld; // Get required player components if (LocalPlayerGPS) { playerEnterExit = LocalPlayerGPS.GetComponent<PlayerEnterExit>(); playerWeather = LocalPlayerGPS.GetComponent<PlayerWeather>(); } }
void TransitionToExterior(PlayerEnterExit.TransitionEventArgs args) { SetUpCameras(); }
void Start() { dfUnity = DaggerfallUnity.Instance; playerEnterExit = GetComponent<PlayerEnterExit>(); }
void Start() { playerEnterExit = GetComponent<PlayerEnterExit>(); sunlightManager = GameManager.Instance.SunlightManager; StartCoroutine(ManageAmbientLight()); }