Blood suck particles

This commit is contained in:
Yann Dupont 01 2022-04-02 16:14:15 -04:00
parent 1b51d18790
commit a4876b4c5e
6 changed files with 4912 additions and 8 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 78e4227a7fbb82040b8d8138dad79b1d
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -208,7 +208,7 @@ MonoBehaviour:
m_Follow: {fileID: 0}
m_Lens:
FieldOfView: 60
OrthographicSize: 10
OrthographicSize: 7
NearClipPlane: 0.3
FarClipPlane: 1000
Dutch: 0

View File

@ -36,6 +36,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 5561158611004983940}
- {fileID: 8877496746214907228}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -72,12 +73,12 @@ MonoBehaviour:
<movementSpeed>k__BackingField: 0
<rotSpeed>k__BackingField: 0
fov: 0
attackRange: 0
<attackRange>k__BackingField: 0
<attackDmg>k__BackingField: 0
attackCooldown: 0
target: {fileID: 0}
halo: {fileID: 0}
playerStats: {fileID: 11400000, guid: 12a626b5a296d934ba078d222ad6ba98, type: 2}
healthBar: {fileID: 0}
--- !u!114 &1967503440015794769
MonoBehaviour:
m_ObjectHideFlags: 0
@ -108,6 +109,7 @@ MonoBehaviour:
suckDuration: 1
suckRange: 3
healthGainFromSuck: 30
bloodParticles: {fileID: 5815394732050939499}
--- !u!212 &1214567908930553595
SpriteRenderer:
m_ObjectHideFlags: 0
@ -467,3 +469,70 @@ SpriteRenderer:
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!1001 &9176030194975883919
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 1214567908930553594}
m_Modifications:
- target: {fileID: 316653409112989651, guid: 78e4227a7fbb82040b8d8138dad79b1d, type: 3}
propertyPath: m_RootOrder
value: 1
objectReference: {fileID: 0}
- target: {fileID: 316653409112989651, guid: 78e4227a7fbb82040b8d8138dad79b1d, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 316653409112989651, guid: 78e4227a7fbb82040b8d8138dad79b1d, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 316653409112989651, guid: 78e4227a7fbb82040b8d8138dad79b1d, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 316653409112989651, guid: 78e4227a7fbb82040b8d8138dad79b1d, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 316653409112989651, guid: 78e4227a7fbb82040b8d8138dad79b1d, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 316653409112989651, guid: 78e4227a7fbb82040b8d8138dad79b1d, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 316653409112989651, guid: 78e4227a7fbb82040b8d8138dad79b1d, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 316653409112989651, guid: 78e4227a7fbb82040b8d8138dad79b1d, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 316653409112989651, guid: 78e4227a7fbb82040b8d8138dad79b1d, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 316653409112989651, guid: 78e4227a7fbb82040b8d8138dad79b1d, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1168153863115657109, guid: 78e4227a7fbb82040b8d8138dad79b1d, type: 3}
propertyPath: m_Name
value: Blood Suck Particles
objectReference: {fileID: 0}
m_RemovedComponents: []
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
ParticleSystem:
m_CorrespondingSourceObject: {fileID: 3450778120571403492, guid: 78e4227a7fbb82040b8d8138dad79b1d, type: 3}
m_PrefabInstance: {fileID: 9176030194975883919}
m_PrefabAsset: {fileID: 0}

View File

@ -12,4 +12,4 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 8de175900b604adb984b49af64538a07, type: 3}
m_Name: Arena Stats
m_EditorClassIdentifier:
secondsBetweenSpawners: 3
secondsBetweenSpawners: 5

View File

@ -8,6 +8,7 @@ public class BloodSucker : MonoBehaviour {
[SerializeField] float suckDuration = 1f;
[SerializeField] float suckRange = 1f;
[SerializeField] float healthGainFromSuck = 30f;
[SerializeField] ParticleSystem bloodParticles;
Entity currentTarget;
VampireEntity vampireEntity;
@ -16,6 +17,7 @@ public class BloodSucker : MonoBehaviour {
void Awake() {
vampireEntity = GetComponent<VampireEntity>();
bloodParticles.Stop(true, ParticleSystemStopBehavior.StopEmitting);
}
void FixedUpdate() {
@ -39,11 +41,11 @@ public class BloodSucker : MonoBehaviour {
public void ToggleSuck(InputAction.CallbackContext context) {
if (context.performed) {
if (currentTarget != null) {
isSucking = true;
SetIsSucking(true);
currentSuckTimer = suckDuration;
}
} else if (context.canceled) {
isSucking = false;
SetIsSucking(false);
}
}
@ -60,7 +62,7 @@ public class BloodSucker : MonoBehaviour {
void SetTarget(Entity newTarget) {
if(newTarget != currentTarget) {
isSucking = false;
SetIsSucking(false);
}
if (currentTarget != null) {
UnHighlightTarget();
@ -75,6 +77,8 @@ public class BloodSucker : MonoBehaviour {
}
void PerformSuck(float deltaTime) {
bloodParticles.gameObject.transform.rotation = Quaternion.FromToRotation(transform.right, currentTarget.transform.position - transform.position);
currentSuckTimer -= deltaTime;
if (currentSuckTimer < 0f) {
currentTarget.bloodTokens -= 1;
@ -82,7 +86,7 @@ public class BloodSucker : MonoBehaviour {
// print("One token sucked");
if (currentTarget.bloodTokens == 0) {
SetTarget(null);
isSucking = false;
SetIsSucking(false);
// TODO : Dispawn target
} else {
currentSuckTimer = suckDuration;
@ -90,6 +94,15 @@ public class BloodSucker : MonoBehaviour {
}
}
void SetIsSucking(bool value) {
isSucking = value;
if(isSucking) {
bloodParticles.Play();
} else {
bloodParticles.Stop(true, ParticleSystemStopBehavior.StopEmitting);
}
}
void HighlightTarget() {
currentTarget.EnableHalo();
}