fix scrapping sound volume jumping around

use a lerp to smooth volume adjustments
This commit is contained in:
jparent 2016-01-31 12:00:05 -05:00
parent c4a88873e2
commit 2523ce3680
4 changed files with 20 additions and 9 deletions

View File

@ -2396,7 +2396,7 @@ Prefab:
objectReference: {fileID: 0}
- target: {fileID: 10833872, guid: 09a2e2e70f49c4330831bd4f733bbdb4, type: 2}
propertyPath: m_Range
value: 252.96521
value: 265.97876
objectReference: {fileID: 0}
- target: {fileID: 169668, guid: 09a2e2e70f49c4330831bd4f733bbdb4, type: 2}
propertyPath: m_Name
@ -2410,6 +2410,10 @@ Prefab:
propertyPath: m_Name
value: Spotlight_blue (right)
objectReference: {fileID: 0}
- target: {fileID: 437796, guid: 09a2e2e70f49c4330831bd4f733bbdb4, type: 2}
propertyPath: m_LocalPosition.y
value: -2.32999992
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 09a2e2e70f49c4330831bd4f733bbdb4, type: 2}
m_IsPrefabParent: 0

View File

@ -21,6 +21,7 @@ public class LevelManager : MonoBehaviour {
private SelectorWithBolts Selector;
private GameObject PhysicsContainer;
private int playerId;
// Use this for initialization
void Start()
@ -83,9 +84,11 @@ public class LevelManager : MonoBehaviour {
{
if (player.hasNextLetter(letterNum))
{
tile.symbol.color = PlayerColors[player.num - 1];
StartCoroutine(MoveSelectorToTile(tile));
playerId = player.num - 1;
tile.symbol.color = PlayerColors[playerId];
StartCoroutine(MoveSelectorToTile(tile));
SoundManager.Instance.PlayRunePickup();
//Do something
@ -154,7 +157,7 @@ public class LevelManager : MonoBehaviour {
Vector3 endPos = cameraTrans.position + cameraTrans.forward * 10f;//trans.position + new Vector3(0f, 5f, 0f);
Quaternion endRot = Quaternion.LookRotation(cameraTrans.forward);
ratio += Time.deltaTime / 2f;
ratio += Time.deltaTime / 1.5f;
trans.position = Vector3.Lerp(startPos, endPos, ratio);
trans.rotation = Quaternion.Slerp(startRot, endRot, ratio);
@ -179,9 +182,11 @@ public class LevelManager : MonoBehaviour {
float ratio = 0f;
while (ratio < 1f)
{
ratio += Time.deltaTime / 0.5f;
ratio += Time.deltaTime / 1f;
Vector3 endPos = Camera.main.ViewportToWorldPoint(new Vector3(0.9f, 0.9f, Camera.main.nearClipPlane + 0.1f));
float viewportX = 0.2f + playerId * 0.3f;
Vector3 endPos = Camera.main.ViewportToWorldPoint(new Vector3(viewportX, 0.8f, Camera.main.nearClipPlane + 0.1f));
trans.position = Vector3.Lerp(startPos, endPos, ratio);
trans.localScale = Vector3.Lerp(startScale, endScale, ratio);

View File

@ -31,7 +31,7 @@ public class SelectorWithBolts : MonoBehaviour
playerCylinders[i] = Ropes[i].GetComponent<Transform>().GetComponentsInChildren<MeshRenderer>();
}
sm = SoundManager.Instance;
}
void Start()
@ -40,6 +40,8 @@ public class SelectorWithBolts : MonoBehaviour
{
ReplenishPlayerDashMeter(i);
}
sm = SoundManager.Instance;
}
void Update()

View File

@ -53,9 +53,9 @@ public class SoundManager : MonoBehaviour
}
}
public void UpdateScrappingVolume( float volume)
public void UpdateScrappingVolume( float newVolume)
{
Scrapping.volume = volume;
Scrapping.volume = Mathf.Lerp(Scrapping.volume, newVolume, Time.deltaTime);
}