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