Breath Sound et control

This commit is contained in:
max89max 2015-11-08 18:08:14 +01:00
parent b12ddfc647
commit 79e803559c
10 changed files with 255 additions and 139 deletions

View File

@ -1,17 +1,17 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &163246
--- !u!1 &112876
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 4
m_Component:
- 4: {fileID: 439454}
- 20: {fileID: 2066902}
- 92: {fileID: 9240338}
- 124: {fileID: 12420880}
- 81: {fileID: 8107576}
- 4: {fileID: 434624}
- 20: {fileID: 2061712}
- 92: {fileID: 9239602}
- 124: {fileID: 12479126}
- 81: {fileID: 8101620}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
@ -19,18 +19,18 @@ GameObject:
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &186122
--- !u!1 &117402
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 4
m_Component:
- 4: {fileID: 476210}
- 114: {fileID: 11486352}
- 143: {fileID: 14332570}
- 54: {fileID: 5437856}
- 82: {fileID: 8242602}
- 4: {fileID: 426836}
- 114: {fileID: 11453604}
- 143: {fileID: 14323870}
- 54: {fileID: 5492406}
- 82: {fileID: 8283000}
m_Layer: 0
m_Name: FirstPerson
m_TagString: Untagged
@ -38,37 +38,66 @@ GameObject:
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &439454
--- !u!1 &167304
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 4
m_Component:
- 4: {fileID: 422960}
- 82: {fileID: 8225872}
m_Layer: 0
m_Name: AudioSourceRespiration
m_TagString: AudioSourceBreath
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &422960
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 163246}
m_GameObject: {fileID: 167304}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: .487160414, y: -.242959023, z: -5.49911785}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 426836}
m_RootOrder: 0
--- !u!4 &426836
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 117402}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -.469999999, y: 2.1099999, z: 2.48688507}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 422960}
- {fileID: 434624}
m_Father: {fileID: 0}
m_RootOrder: 0
--- !u!4 &434624
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 112876}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 476210}
m_RootOrder: 0
--- !u!4 &476210
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 186122}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: .545000017, z: -.409999996}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 439454}
m_Father: {fileID: 0}
m_RootOrder: 0
--- !u!20 &2066902
m_Father: {fileID: 426836}
m_RootOrder: 1
--- !u!20 &2061712
Camera:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 163246}
m_GameObject: {fileID: 112876}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
@ -97,12 +126,12 @@ Camera:
m_StereoConvergence: 10
m_StereoSeparation: .0219999999
m_StereoMirrorMode: 0
--- !u!54 &5437856
--- !u!54 &5492406
Rigidbody:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 186122}
m_GameObject: {fileID: 117402}
serializedVersion: 2
m_Mass: 1
m_Drag: 0
@ -112,19 +141,19 @@ Rigidbody:
m_Interpolate: 0
m_Constraints: 0
m_CollisionDetection: 0
--- !u!81 &8107576
--- !u!81 &8101620
AudioListener:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 163246}
m_GameObject: {fileID: 112876}
m_Enabled: 1
--- !u!82 &8242602
--- !u!82 &8225872
AudioSource:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 186122}
m_GameObject: {fileID: 167304}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 0}
@ -189,19 +218,89 @@ AudioSource:
tangentMode: 0
m_PreInfinity: 2
m_PostInfinity: 2
--- !u!92 &9240338
--- !u!82 &8283000
AudioSource:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 117402}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 0}
m_PlayOnAwake: 1
m_Volume: 1
m_Pitch: 1
Loop: 0
Mute: 0
Spatialize: 0
Priority: 128
DopplerLevel: 1
MinDistance: 1
MaxDistance: 500
Pan2D: 0
rolloffMode: 0
BypassEffects: 0
BypassListenerEffects: 0
BypassReverbZones: 0
rolloffCustomCurve:
serializedVersion: 2
m_Curve:
- time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
- time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
m_PreInfinity: 2
m_PostInfinity: 2
panLevelCustomCurve:
serializedVersion: 2
m_Curve:
- time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
m_PreInfinity: 2
m_PostInfinity: 2
spreadCustomCurve:
serializedVersion: 2
m_Curve:
- time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
m_PreInfinity: 2
m_PostInfinity: 2
reverbZoneMixCustomCurve:
serializedVersion: 2
m_Curve:
- time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
m_PreInfinity: 2
m_PostInfinity: 2
--- !u!92 &9239602
Behaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 163246}
m_GameObject: {fileID: 112876}
m_Enabled: 1
--- !u!114 &11486352
--- !u!114 &11453604
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 186122}
m_GameObject: {fileID: 117402}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4bcce75dab8f540b797340354c772d8b, type: 3}
@ -285,19 +384,21 @@ MonoBehaviour:
- {fileID: 8300000, guid: 8bc94ec6ed537e743b481638bdcd503d, type: 3}
m_JumpSound: {fileID: 8300000, guid: 5897aeed9b676024fbb8c694b421a861, type: 3}
m_LandSound: {fileID: 8300000, guid: 3b09d59f4499d45428baa7a21e954296, type: 3}
--- !u!124 &12420880
m_RespireSound: {fileID: 8300000, guid: 6336350fc2bc6e74185163c95a6485dc, type: 3}
m_NoStaminaSound: {fileID: 8300000, guid: 96ec8c58b35c5354e9d23061d25a23d6, type: 3}
--- !u!124 &12479126
Behaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 163246}
m_GameObject: {fileID: 112876}
m_Enabled: 1
--- !u!143 &14332570
--- !u!143 &14323870
CharacterController:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 186122}
m_GameObject: {fileID: 117402}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
@ -317,70 +418,10 @@ Prefab:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 0}
propertyPath: m_FootstepSounds.Array.size
value: 2
objectReference: {fileID: 0}
- target: {fileID: 0}
propertyPath: m_JumpSpeed
value: 10
objectReference: {fileID: 0}
- target: {fileID: 0}
propertyPath: m_StickToGroundForce
value: 10
objectReference: {fileID: 0}
- target: {fileID: 0}
propertyPath: m_GravityMultiplier
value: 2
objectReference: {fileID: 0}
- target: {fileID: 0}
propertyPath: m_RunstepLenghten
value: .699999988
objectReference: {fileID: 0}
- target: {fileID: 0}
propertyPath: m_UseFovKick
value: 1
objectReference: {fileID: 0}
- target: {fileID: 0}
propertyPath: m_UseHeadBob
value: 1
objectReference: {fileID: 0}
- target: {fileID: 0}
propertyPath: m_StepInterval
value: 5
objectReference: {fileID: 0}
- target: {fileID: 0}
propertyPath: m_JumpSound
value:
objectReference: {fileID: 8300000, guid: 5897aeed9b676024fbb8c694b421a861, type: 3}
- target: {fileID: 0}
propertyPath: m_LandSound
value:
objectReference: {fileID: 8300000, guid: 3b09d59f4499d45428baa7a21e954296, type: 3}
- target: {fileID: 0}
propertyPath: m_FootstepSounds.Array.data[0]
value:
objectReference: {fileID: 8300000, guid: 42e65e088b3f4374e851b8dbd38f3df9, type: 3}
- target: {fileID: 0}
propertyPath: m_FootstepSounds.Array.data[1]
value:
objectReference: {fileID: 8300000, guid: 8bc94ec6ed537e743b481638bdcd503d, type: 3}
- target: {fileID: 0}
propertyPath: m_JumpBob.BobDuration
value: .200000003
objectReference: {fileID: 0}
- target: {fileID: 0}
propertyPath: m_JumpBob.BobAmount
value: .100000001
objectReference: {fileID: 0}
- target: {fileID: 0}
propertyPath: m_HeadBob.HorizontalBobRange
value: .100000001
objectReference: {fileID: 0}
- target: {fileID: 0}
propertyPath: m_HeadBob.VerticalBobRange
value: .100000001
propertyPath: m_TagString
value: AudioSourceBreath
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 0}
m_RootGameObject: {fileID: 186122}
m_RootGameObject: {fileID: 117402}
m_IsPrefabParent: 1

View File

@ -1,6 +1,6 @@
fileFormatVersion: 2
guid: e180da7fedba0004086c3f44426d29c5
timeCreated: 1446998360
timeCreated: 1447000680
licenseType: Free
NativeFormatImporter:
userData:

View File

@ -134,46 +134,38 @@ Prefab:
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 476210, guid: e180da7fedba0004086c3f44426d29c5, type: 2}
- target: {fileID: 426836, guid: e180da7fedba0004086c3f44426d29c5, type: 2}
propertyPath: m_LocalPosition.x
value: -.469999999
objectReference: {fileID: 0}
- target: {fileID: 476210, guid: e180da7fedba0004086c3f44426d29c5, type: 2}
- target: {fileID: 426836, guid: e180da7fedba0004086c3f44426d29c5, type: 2}
propertyPath: m_LocalPosition.y
value: 2.1099999
objectReference: {fileID: 0}
- target: {fileID: 476210, guid: e180da7fedba0004086c3f44426d29c5, type: 2}
- target: {fileID: 426836, guid: e180da7fedba0004086c3f44426d29c5, type: 2}
propertyPath: m_LocalPosition.z
value: 2.48688507
objectReference: {fileID: 0}
- target: {fileID: 476210, guid: e180da7fedba0004086c3f44426d29c5, type: 2}
- target: {fileID: 426836, guid: e180da7fedba0004086c3f44426d29c5, type: 2}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 476210, guid: e180da7fedba0004086c3f44426d29c5, type: 2}
- target: {fileID: 426836, guid: e180da7fedba0004086c3f44426d29c5, type: 2}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 476210, guid: e180da7fedba0004086c3f44426d29c5, type: 2}
- target: {fileID: 426836, guid: e180da7fedba0004086c3f44426d29c5, type: 2}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 476210, guid: e180da7fedba0004086c3f44426d29c5, type: 2}
- target: {fileID: 426836, guid: e180da7fedba0004086c3f44426d29c5, type: 2}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 476210, guid: e180da7fedba0004086c3f44426d29c5, type: 2}
- target: {fileID: 426836, guid: e180da7fedba0004086c3f44426d29c5, type: 2}
propertyPath: m_RootOrder
value: 1
objectReference: {fileID: 0}
- target: {fileID: 11486352, guid: e180da7fedba0004086c3f44426d29c5, type: 2}
propertyPath: m_JumpBob.BobDuration
value: .200000003
objectReference: {fileID: 0}
- target: {fileID: 11486352, guid: e180da7fedba0004086c3f44426d29c5, type: 2}
propertyPath: m_JumpBob.BobAmount
value: .100000001
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: e180da7fedba0004086c3f44426d29c5, type: 2}
m_IsPrefabParent: 0

View File

@ -31,6 +31,8 @@ namespace UnityStandardAssets.Characters.FirstPerson
[SerializeField] private AudioClip[] m_FootstepSounds; // an array of footstep sounds that will be randomly selected from.
[SerializeField] private AudioClip m_JumpSound; // the sound played when character leaves the ground.
[SerializeField] private AudioClip m_LandSound; // the sound played when character touches back on ground.
[SerializeField] private AudioClip m_RespireSound; // the sound played when character touches back on ground.
[SerializeField] private AudioClip m_NoStaminaSound; // the sound played when character touches back on ground.
private Camera m_Camera;
private bool m_Jump;
@ -47,6 +49,7 @@ namespace UnityStandardAssets.Characters.FirstPerson
private float m_NextStep;
private bool m_Jumping;
private AudioSource m_AudioSource;
private AudioSource m_AudioSourceChild;
private MilesStonesPARA currentMilestone;
// Use this for initialization
@ -62,6 +65,7 @@ namespace UnityStandardAssets.Characters.FirstPerson
m_NextStep = m_StepCycle/2f;
m_Jumping = false;
m_AudioSource = GetComponent<AudioSource>();
m_AudioSourceChild = GameObject.FindGameObjectWithTag("AudioSourceBreath").GetComponent<AudioSource>();
m_MouseLook.Init(transform , m_Camera.transform);
}
@ -98,8 +102,46 @@ namespace UnityStandardAssets.Characters.FirstPerson
m_AudioSource.Play();
m_NextStep = m_StepCycle + .5f;
}
private void PlayRespireSound()
{
bool changeSound;
if(Input.GetButton("StopRespire") && canSprint)
{
//Stopper la respiration et auguementer les sons
m_AudioSourceChild.volume -= 0.05f;
if(m_AudioSourceChild.volume <0)
m_AudioSourceChild.volume=0;
}
else
{
//Repiration sounds
m_AudioSourceChild.volume += 0.3f;
if(m_AudioSourceChild.volume >1)
m_AudioSourceChild.volume=1;
}
if(m_Stamina < 100)
{
if(m_AudioSourceChild.clip == m_NoStaminaSound)
changeSound=false;
else
changeSound=true;
m_AudioSourceChild.clip = m_NoStaminaSound;
}
else
{
if(m_AudioSourceChild.clip == m_RespireSound)
changeSound=false;
else
changeSound=true;
m_AudioSourceChild.clip = m_RespireSound;
}
if(changeSound || !m_AudioSourceChild.isPlaying)
m_AudioSourceChild.Play();
m_NextStep = m_StepCycle + .5f;
}
private void FixedUpdate()
{
float speed;
@ -115,7 +157,8 @@ namespace UnityStandardAssets.Characters.FirstPerson
m_MoveDir.x = desiredMove.x*speed;
m_MoveDir.z = desiredMove.z*speed;
PlayRespireSound();
//Actions joueur
if(Input.GetButton("Briquet"))
{
@ -182,14 +225,6 @@ namespace UnityStandardAssets.Characters.FirstPerson
m_NbrAllumettes--;
DestroyObject(GameObject.FindGameObjectWithTag("Allumettes"));
}
if(Input.GetButton("StopRespire"))
//Stopper la respiration et auguementer les sons
print("yo2");
else
//Repiration sounds
print("yo3");
if (m_CharacterController.isGrounded)
{
m_MoveDir.y = -m_StickToGroundForce;
@ -293,7 +328,7 @@ namespace UnityStandardAssets.Characters.FirstPerson
// keep track of whether or not the character is walking or running
m_IsWalking = !CrossPlatformInputManager.GetButton("Course");
//Si le joueur marche. Il reprend de l'énergie
if(m_IsWalking)
if(m_IsWalking && !Input.GetButton("StopRespire"))
{
m_Stamina += 5;
if(m_Stamina >= 500)
@ -302,7 +337,7 @@ namespace UnityStandardAssets.Characters.FirstPerson
m_Stamina = 1000;
}
//Sinon il court, mais il perd de l'énergie
else
else if(!m_IsWalking || Input.GetButton("StopRespire"))
{
m_Stamina -= 10;
if(m_Stamina < 0)

Binary file not shown.

View File

@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: 96ec8c58b35c5354e9d23061d25a23d6
timeCreated: 1446999672
licenseType: Free
AudioImporter:
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
preloadAudioData: 1
loadInBackground: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Sound/repire.mp3 Normal file

Binary file not shown.

View File

@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: 6336350fc2bc6e74185163c95a6485dc
timeCreated: 1446999670
licenseType: Free
AudioImporter:
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
preloadAudioData: 1
loadInBackground: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

View File

@ -235,7 +235,7 @@ InputManager:
descriptiveNegativeName:
negativeButton:
positiveButton: joystick button 9
altNegativeButton: space
altNegativeButton: c
altPositiveButton:
gravity: 1000
dead: .00100000005

View File

@ -5,6 +5,10 @@ TagManager:
serializedVersion: 2
tags:
- Trap
- Briquet
- MilesStones
- Allumettes
- AudioSourceBreath
layers:
- Default
- TransparentFX