Blood suck SFX
This commit is contained in:
parent
b6d889a18a
commit
02f7d4c5b3
@ -132,6 +132,13 @@ MonoBehaviour:
|
|||||||
suckRange: 3
|
suckRange: 3
|
||||||
healthGainFromSuck: 30
|
healthGainFromSuck: 30
|
||||||
bloodParticles: {fileID: 5815394732050939499}
|
bloodParticles: {fileID: 5815394732050939499}
|
||||||
|
suckingSource: {fileID: 4400190155669501391}
|
||||||
|
suckingSounds:
|
||||||
|
- {fileID: 8300000, guid: cae9a7c20818b7f4aa0761951e1b5b2b, type: 3}
|
||||||
|
suckSource: {fileID: 3555231741827846396}
|
||||||
|
suckSounds:
|
||||||
|
- {fileID: 8300000, guid: c12a57d990960ce44bc7cf4d5f63d32b, type: 3}
|
||||||
|
soundManager: {fileID: 0}
|
||||||
--- !u!114 &1214567908930553477
|
--- !u!114 &1214567908930553477
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -400,6 +407,8 @@ Transform:
|
|||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 3632678902316393644}
|
- {fileID: 3632678902316393644}
|
||||||
- {fileID: 8766613565529140840}
|
- {fileID: 8766613565529140840}
|
||||||
|
- {fileID: 6919064404994049919}
|
||||||
|
- {fileID: 7801168753088406092}
|
||||||
m_Father: {fileID: 1214567908930553594}
|
m_Father: {fileID: 1214567908930553594}
|
||||||
m_RootOrder: 4
|
m_RootOrder: 4
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
@ -767,6 +776,140 @@ AudioSource:
|
|||||||
m_CorrespondingSourceObject: {fileID: 6767790137851257392, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
|
m_CorrespondingSourceObject: {fileID: 6767790137851257392, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
|
||||||
m_PrefabInstance: {fileID: 3643467873725871148}
|
m_PrefabInstance: {fileID: 3643467873725871148}
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
--- !u!1001 &6988628843130902527
|
||||||
|
PrefabInstance:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Modification:
|
||||||
|
m_TransformParent: {fileID: 903222670005920393}
|
||||||
|
m_Modifications:
|
||||||
|
- target: {fileID: 70347360213241984, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
|
||||||
|
propertyPath: m_RootOrder
|
||||||
|
value: 2
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 70347360213241984, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 70347360213241984, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 70347360213241984, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 70347360213241984, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.w
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 70347360213241984, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 70347360213241984, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 70347360213241984, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 70347360213241984, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 70347360213241984, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 70347360213241984, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6915619910278317271, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
|
||||||
|
propertyPath: m_Name
|
||||||
|
value: Sucking Source
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
m_RemovedComponents: []
|
||||||
|
m_SourcePrefab: {fileID: 100100000, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
|
||||||
|
--- !u!4 &6919064404994049919 stripped
|
||||||
|
Transform:
|
||||||
|
m_CorrespondingSourceObject: {fileID: 70347360213241984, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
|
||||||
|
m_PrefabInstance: {fileID: 6988628843130902527}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
--- !u!82 &4400190155669501391 stripped
|
||||||
|
AudioSource:
|
||||||
|
m_CorrespondingSourceObject: {fileID: 6767790137851257392, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
|
||||||
|
m_PrefabInstance: {fileID: 6988628843130902527}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
--- !u!1001 &7834782494696387276
|
||||||
|
PrefabInstance:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Modification:
|
||||||
|
m_TransformParent: {fileID: 903222670005920393}
|
||||||
|
m_Modifications:
|
||||||
|
- target: {fileID: 70347360213241984, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
|
||||||
|
propertyPath: m_RootOrder
|
||||||
|
value: 3
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 70347360213241984, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 70347360213241984, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 70347360213241984, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 70347360213241984, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.w
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 70347360213241984, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 70347360213241984, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 70347360213241984, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 70347360213241984, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 70347360213241984, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 70347360213241984, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6915619910278317271, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
|
||||||
|
propertyPath: m_Name
|
||||||
|
value: Suck Source
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
m_RemovedComponents: []
|
||||||
|
m_SourcePrefab: {fileID: 100100000, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
|
||||||
|
--- !u!4 &7801168753088406092 stripped
|
||||||
|
Transform:
|
||||||
|
m_CorrespondingSourceObject: {fileID: 70347360213241984, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
|
||||||
|
m_PrefabInstance: {fileID: 7834782494696387276}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
--- !u!82 &3555231741827846396 stripped
|
||||||
|
AudioSource:
|
||||||
|
m_CorrespondingSourceObject: {fileID: 6767790137851257392, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
|
||||||
|
m_PrefabInstance: {fileID: 7834782494696387276}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
--- !u!1001 &8741671706484653800
|
--- !u!1001 &8741671706484653800
|
||||||
PrefabInstance:
|
PrefabInstance:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -891,13 +1034,13 @@ PrefabInstance:
|
|||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
m_RemovedComponents: []
|
m_RemovedComponents: []
|
||||||
m_SourcePrefab: {fileID: 100100000, guid: 78e4227a7fbb82040b8d8138dad79b1d, type: 3}
|
m_SourcePrefab: {fileID: 100100000, guid: 78e4227a7fbb82040b8d8138dad79b1d, type: 3}
|
||||||
--- !u!4 &8877496746214907228 stripped
|
|
||||||
Transform:
|
|
||||||
m_CorrespondingSourceObject: {fileID: 316653409112989651, guid: 78e4227a7fbb82040b8d8138dad79b1d, type: 3}
|
|
||||||
m_PrefabInstance: {fileID: 9176030194975883919}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
--- !u!198 &5815394732050939499 stripped
|
--- !u!198 &5815394732050939499 stripped
|
||||||
ParticleSystem:
|
ParticleSystem:
|
||||||
m_CorrespondingSourceObject: {fileID: 3450778120571403492, guid: 78e4227a7fbb82040b8d8138dad79b1d, type: 3}
|
m_CorrespondingSourceObject: {fileID: 3450778120571403492, guid: 78e4227a7fbb82040b8d8138dad79b1d, type: 3}
|
||||||
m_PrefabInstance: {fileID: 9176030194975883919}
|
m_PrefabInstance: {fileID: 9176030194975883919}
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
--- !u!4 &8877496746214907228 stripped
|
||||||
|
Transform:
|
||||||
|
m_CorrespondingSourceObject: {fileID: 316653409112989651, guid: 78e4227a7fbb82040b8d8138dad79b1d, type: 3}
|
||||||
|
m_PrefabInstance: {fileID: 9176030194975883919}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
|||||||
@ -9,15 +9,21 @@ public class BloodSucker : MonoBehaviour {
|
|||||||
[SerializeField] float suckRange = 1f;
|
[SerializeField] float suckRange = 1f;
|
||||||
[SerializeField] float healthGainFromSuck = 30f;
|
[SerializeField] float healthGainFromSuck = 30f;
|
||||||
[SerializeField] ParticleSystem bloodParticles;
|
[SerializeField] ParticleSystem bloodParticles;
|
||||||
|
[SerializeField] AudioSource suckingSource;
|
||||||
|
[SerializeField] AudioClip[] suckingSounds;
|
||||||
|
[SerializeField] AudioSource suckSource;
|
||||||
|
[SerializeField] AudioClip[] suckSounds;
|
||||||
|
|
||||||
Entity currentTarget;
|
Entity currentTarget;
|
||||||
VampireEntity vampireEntity;
|
VampireEntity vampireEntity;
|
||||||
bool isSucking;
|
bool isSucking;
|
||||||
float currentSuckTimer;
|
float currentSuckTimer;
|
||||||
|
[HideInInspector] public SoundManager soundManager;
|
||||||
|
|
||||||
void Awake() {
|
void Awake() {
|
||||||
vampireEntity = GetComponent<VampireEntity>();
|
vampireEntity = GetComponent<VampireEntity>();
|
||||||
bloodParticles.Stop(true, ParticleSystemStopBehavior.StopEmitting);
|
bloodParticles.Stop(true, ParticleSystemStopBehavior.StopEmitting);
|
||||||
|
soundManager = FindObjectOfType<SoundManager>();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FixedUpdate() {
|
void FixedUpdate() {
|
||||||
@ -95,6 +101,7 @@ public class BloodSucker : MonoBehaviour {
|
|||||||
currentTarget.bloodTokens -= 1;
|
currentTarget.bloodTokens -= 1;
|
||||||
vampireEntity.HealDamage(healthGainFromSuck);
|
vampireEntity.HealDamage(healthGainFromSuck);
|
||||||
// print("One token sucked");
|
// print("One token sucked");
|
||||||
|
soundManager.PlaySound(suckSource, suckSounds, randomPitch:true, createTempSourceIfBusy:true);
|
||||||
if (currentTarget.bloodTokens == 0) {
|
if (currentTarget.bloodTokens == 0) {
|
||||||
SetIsSucking(false);
|
SetIsSucking(false);
|
||||||
SetTarget(null);
|
SetTarget(null);
|
||||||
@ -110,9 +117,11 @@ public class BloodSucker : MonoBehaviour {
|
|||||||
if(isSucking) {
|
if(isSucking) {
|
||||||
bloodParticles.Play();
|
bloodParticles.Play();
|
||||||
currentTarget.OnSuck(true);
|
currentTarget.OnSuck(true);
|
||||||
|
soundManager.PlaySound(suckingSource, suckingSounds, randomPitch: true, createTempSourceIfBusy: false);
|
||||||
} else {
|
} else {
|
||||||
bloodParticles.Stop(true, ParticleSystemStopBehavior.StopEmitting);
|
bloodParticles.Stop(true, ParticleSystemStopBehavior.StopEmitting);
|
||||||
if(!(currentTarget is null))currentTarget.OnSuck(false);
|
if(!(currentTarget is null))currentTarget.OnSuck(false);
|
||||||
|
soundManager.StopSound(suckingSource);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -81,6 +81,10 @@ public class SoundManager : MonoBehaviour {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void StopSound(AudioSource source) {
|
||||||
|
source.Stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
IEnumerator DelayedPlaySound(AudioSource source, float delay) {
|
IEnumerator DelayedPlaySound(AudioSource source, float delay) {
|
||||||
yield return new WaitForSeconds(delay);
|
yield return new WaitForSeconds(delay);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user