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() { // 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; }