Update knockback direction to allow either facing direction or direction from player
This commit is contained in:
parent
6883df0d14
commit
909f1e0ae7
@ -104,6 +104,7 @@ public class ClassBase {
|
|||||||
var center = PlayerPos + Player.PrevDirection * centerOffset;
|
var center = PlayerPos + Player.PrevDirection * centerOffset;
|
||||||
hitDelay = 0;
|
hitDelay = 0;
|
||||||
HitBoxDraw.Knockback = knockback;
|
HitBoxDraw.Knockback = knockback;
|
||||||
|
HitBoxDraw.Directional = centerOffset != 0;
|
||||||
AttackCoroutine = Player.Instance.StartCoroutine(CreateHitBoxHelper(center, radius, hitDelay, hitDuration));
|
AttackCoroutine = Player.Instance.StartCoroutine(CreateHitBoxHelper(center, radius, hitDelay, hitDuration));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,6 +129,7 @@ public class ClassBase {
|
|||||||
public class HitBoxDrawClass {
|
public class HitBoxDrawClass {
|
||||||
public bool Draw;
|
public bool Draw;
|
||||||
public bool Active;
|
public bool Active;
|
||||||
|
public bool Directional;
|
||||||
public Vector2 Center;
|
public Vector2 Center;
|
||||||
public float Radius;
|
public float Radius;
|
||||||
public Color Color;
|
public Color Color;
|
||||||
|
|||||||
@ -76,6 +76,7 @@ public class MeleeFighterClass : ClassBase {
|
|||||||
AnimationToPlay = "Attack1";
|
AnimationToPlay = "Attack1";
|
||||||
TextPopUp.SpawnFloatingText("KineticSurge", Color.red, 3);
|
TextPopUp.SpawnFloatingText("KineticSurge", Color.red, 3);
|
||||||
AllowBladeVortex = ComboTimeElapsed <= 0.1f;
|
AllowBladeVortex = ComboTimeElapsed <= 0.1f;
|
||||||
|
CreateHitBoxOffset(0, 5, 0.1f, 0.1f, 20);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
@ -223,6 +224,7 @@ public class MeleeFighterClass : ClassBase {
|
|||||||
case AttackState.Shockwave:
|
case AttackState.Shockwave:
|
||||||
AnimationToPlay = "Shockwave";
|
AnimationToPlay = "Shockwave";
|
||||||
Player.VfxShockwavePool.Get(Player.transform.position);
|
Player.VfxShockwavePool.Get(Player.transform.position);
|
||||||
|
CreateHitBoxOffset(0, 5, 0.1f, 0.1f, 20);
|
||||||
Player.IsJumping = false;
|
Player.IsJumping = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@ -203,8 +203,8 @@ public class Player : MonoBehaviour {
|
|||||||
if (!hit.CompareTag("EnemyHurtBox")) continue;
|
if (!hit.CompareTag("EnemyHurtBox")) continue;
|
||||||
|
|
||||||
GameObject parent = hit.transform.parent?.gameObject;
|
GameObject parent = hit.transform.parent?.gameObject;
|
||||||
//EnemySpawnerData.EnemyMap[parent].TakeDamage(0, transform.position - parent.transform.position);
|
Vector2 knockbakDirection = ActiveClass.HitBoxDraw.Directional ? PrevDirection : parent.transform.position - transform.position;
|
||||||
EnemySpawnerData.EnemyMap[parent].Damage(0, PrevDirection, ActiveClass.HitBoxDraw.Knockback);
|
EnemySpawnerData.EnemyMap[parent].Damage(0, knockbakDirection, ActiveClass.HitBoxDraw.Knockback);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user