This commit is contained in:
RosimInc 2016-04-09 16:21:12 -04:00
commit bf8d43e571
8 changed files with 69 additions and 4 deletions

View File

@ -40,7 +40,7 @@ AudioSource:
OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 8300000, guid: 3d4d970a0bbdd934e95ffcf72fc5225c, type: 3}
m_PlayOnAwake: 0
m_Volume: 1
m_Volume: 0.01
m_Pitch: 1
Loop: 0
Mute: 0

View File

@ -86,7 +86,7 @@ AudioSource:
OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 8300000, guid: 3d4d970a0bbdd934e95ffcf72fc5225c, type: 3}
m_PlayOnAwake: 0
m_Volume: 1
m_Volume: 0.01
m_Pitch: 1
Loop: 0
Mute: 0
@ -160,7 +160,7 @@ AudioSource:
OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 8300000, guid: 3d4d970a0bbdd934e95ffcf72fc5225c, type: 3}
m_PlayOnAwake: 0
m_Volume: 1
m_Volume: 0.01
m_Pitch: 1
Loop: 0
Mute: 0

View File

@ -0,0 +1,36 @@
using UnityEngine;
using System.Collections;
public class CameraShake : MonoBehaviour
{
public float shakeTimeAmount = 0.0f;
public float shakeAmount = 0.7f;
public float decreaseFactor = 1.0f;
private Camera camera;
// Use this for initialization
public void Start ()
{
camera = gameObject.GetComponent<Camera>();
}
// Update is called once per frame
public void FixedUpdate () {
if (shakeTimeAmount > 0)
{
var tempShakePosition = camera.transform.localPosition = Random.insideUnitSphere * shakeAmount;
tempShakePosition.z = -10f; // lock z from shaking...
camera.transform.localPosition = tempShakePosition; //
shakeTimeAmount -= Time.deltaTime * decreaseFactor;
}
else
{
shakeTimeAmount = 0.0f;
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 015d8005b8f2f454da584e55b55711f5
timeCreated: 1460231903
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1005,6 +1005,7 @@ GameObject:
- 92: {fileID: 1945693980}
- 124: {fileID: 1945693979}
- 81: {fileID: 1945693978}
- 114: {fileID: 1945693983}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
@ -1079,3 +1080,17 @@ Transform:
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
--- !u!114 &1945693983
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1945693977}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 015d8005b8f2f454da584e55b55711f5, type: 3}
m_Name:
m_EditorClassIdentifier:
shakeTimeAmount: 2
shakeAmount: 0.6
decreaseFactor: 1

View File

@ -4,4 +4,6 @@
EditorBuildSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Scenes: []
m_Scenes:
- enabled: 1
path: Assets/_Scenes/Main.unity