Blood suck particles
This commit is contained in:
parent
1b51d18790
commit
a4876b4c5e
4815
Assets/Prefabs/Blood Suck Particles.prefab
Normal file
4815
Assets/Prefabs/Blood Suck Particles.prefab
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/Prefabs/Blood Suck Particles.prefab.meta
Normal file
7
Assets/Prefabs/Blood Suck Particles.prefab.meta
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 78e4227a7fbb82040b8d8138dad79b1d
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -208,7 +208,7 @@ MonoBehaviour:
|
|||||||
m_Follow: {fileID: 0}
|
m_Follow: {fileID: 0}
|
||||||
m_Lens:
|
m_Lens:
|
||||||
FieldOfView: 60
|
FieldOfView: 60
|
||||||
OrthographicSize: 10
|
OrthographicSize: 7
|
||||||
NearClipPlane: 0.3
|
NearClipPlane: 0.3
|
||||||
FarClipPlane: 1000
|
FarClipPlane: 1000
|
||||||
Dutch: 0
|
Dutch: 0
|
||||||
|
|||||||
@ -36,6 +36,7 @@ Transform:
|
|||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 5561158611004983940}
|
- {fileID: 5561158611004983940}
|
||||||
|
- {fileID: 8877496746214907228}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 0
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
@ -72,12 +73,12 @@ MonoBehaviour:
|
|||||||
<movementSpeed>k__BackingField: 0
|
<movementSpeed>k__BackingField: 0
|
||||||
<rotSpeed>k__BackingField: 0
|
<rotSpeed>k__BackingField: 0
|
||||||
fov: 0
|
fov: 0
|
||||||
attackRange: 0
|
<attackRange>k__BackingField: 0
|
||||||
<attackDmg>k__BackingField: 0
|
<attackDmg>k__BackingField: 0
|
||||||
attackCooldown: 0
|
attackCooldown: 0
|
||||||
target: {fileID: 0}
|
target: {fileID: 0}
|
||||||
|
halo: {fileID: 0}
|
||||||
playerStats: {fileID: 11400000, guid: 12a626b5a296d934ba078d222ad6ba98, type: 2}
|
playerStats: {fileID: 11400000, guid: 12a626b5a296d934ba078d222ad6ba98, type: 2}
|
||||||
healthBar: {fileID: 0}
|
|
||||||
--- !u!114 &1967503440015794769
|
--- !u!114 &1967503440015794769
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -108,6 +109,7 @@ MonoBehaviour:
|
|||||||
suckDuration: 1
|
suckDuration: 1
|
||||||
suckRange: 3
|
suckRange: 3
|
||||||
healthGainFromSuck: 30
|
healthGainFromSuck: 30
|
||||||
|
bloodParticles: {fileID: 5815394732050939499}
|
||||||
--- !u!212 &1214567908930553595
|
--- !u!212 &1214567908930553595
|
||||||
SpriteRenderer:
|
SpriteRenderer:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -467,3 +469,70 @@ SpriteRenderer:
|
|||||||
m_WasSpriteAssigned: 1
|
m_WasSpriteAssigned: 1
|
||||||
m_MaskInteraction: 0
|
m_MaskInteraction: 0
|
||||||
m_SpriteSortPoint: 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}
|
||||||
|
|||||||
@ -12,4 +12,4 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: 8de175900b604adb984b49af64538a07, type: 3}
|
m_Script: {fileID: 11500000, guid: 8de175900b604adb984b49af64538a07, type: 3}
|
||||||
m_Name: Arena Stats
|
m_Name: Arena Stats
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
secondsBetweenSpawners: 3
|
secondsBetweenSpawners: 5
|
||||||
|
|||||||
@ -8,6 +8,7 @@ public class BloodSucker : MonoBehaviour {
|
|||||||
[SerializeField] float suckDuration = 1f;
|
[SerializeField] float suckDuration = 1f;
|
||||||
[SerializeField] float suckRange = 1f;
|
[SerializeField] float suckRange = 1f;
|
||||||
[SerializeField] float healthGainFromSuck = 30f;
|
[SerializeField] float healthGainFromSuck = 30f;
|
||||||
|
[SerializeField] ParticleSystem bloodParticles;
|
||||||
|
|
||||||
Entity currentTarget;
|
Entity currentTarget;
|
||||||
VampireEntity vampireEntity;
|
VampireEntity vampireEntity;
|
||||||
@ -16,6 +17,7 @@ public class BloodSucker : MonoBehaviour {
|
|||||||
|
|
||||||
void Awake() {
|
void Awake() {
|
||||||
vampireEntity = GetComponent<VampireEntity>();
|
vampireEntity = GetComponent<VampireEntity>();
|
||||||
|
bloodParticles.Stop(true, ParticleSystemStopBehavior.StopEmitting);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FixedUpdate() {
|
void FixedUpdate() {
|
||||||
@ -39,11 +41,11 @@ public class BloodSucker : MonoBehaviour {
|
|||||||
public void ToggleSuck(InputAction.CallbackContext context) {
|
public void ToggleSuck(InputAction.CallbackContext context) {
|
||||||
if (context.performed) {
|
if (context.performed) {
|
||||||
if (currentTarget != null) {
|
if (currentTarget != null) {
|
||||||
isSucking = true;
|
SetIsSucking(true);
|
||||||
currentSuckTimer = suckDuration;
|
currentSuckTimer = suckDuration;
|
||||||
}
|
}
|
||||||
} else if (context.canceled) {
|
} else if (context.canceled) {
|
||||||
isSucking = false;
|
SetIsSucking(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,7 +62,7 @@ public class BloodSucker : MonoBehaviour {
|
|||||||
|
|
||||||
void SetTarget(Entity newTarget) {
|
void SetTarget(Entity newTarget) {
|
||||||
if(newTarget != currentTarget) {
|
if(newTarget != currentTarget) {
|
||||||
isSucking = false;
|
SetIsSucking(false);
|
||||||
}
|
}
|
||||||
if (currentTarget != null) {
|
if (currentTarget != null) {
|
||||||
UnHighlightTarget();
|
UnHighlightTarget();
|
||||||
@ -75,6 +77,8 @@ public class BloodSucker : MonoBehaviour {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PerformSuck(float deltaTime) {
|
void PerformSuck(float deltaTime) {
|
||||||
|
bloodParticles.gameObject.transform.rotation = Quaternion.FromToRotation(transform.right, currentTarget.transform.position - transform.position);
|
||||||
|
|
||||||
currentSuckTimer -= deltaTime;
|
currentSuckTimer -= deltaTime;
|
||||||
if (currentSuckTimer < 0f) {
|
if (currentSuckTimer < 0f) {
|
||||||
currentTarget.bloodTokens -= 1;
|
currentTarget.bloodTokens -= 1;
|
||||||
@ -82,7 +86,7 @@ public class BloodSucker : MonoBehaviour {
|
|||||||
// print("One token sucked");
|
// print("One token sucked");
|
||||||
if (currentTarget.bloodTokens == 0) {
|
if (currentTarget.bloodTokens == 0) {
|
||||||
SetTarget(null);
|
SetTarget(null);
|
||||||
isSucking = false;
|
SetIsSucking(false);
|
||||||
// TODO : Dispawn target
|
// TODO : Dispawn target
|
||||||
} else {
|
} else {
|
||||||
currentSuckTimer = suckDuration;
|
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() {
|
void HighlightTarget() {
|
||||||
currentTarget.EnableHalo();
|
currentTarget.EnableHalo();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user