diff --git a/Assets/Scripts/Runtime/AI/EnemyManager/Gobler.cs b/Assets/Scripts/Runtime/AI/EnemyManager/Gobler.cs index 25548ea..73c42a0 100644 --- a/Assets/Scripts/Runtime/AI/EnemyManager/Gobler.cs +++ b/Assets/Scripts/Runtime/AI/EnemyManager/Gobler.cs @@ -23,6 +23,7 @@ public class Gobler : Alive { [SerializeField] public float Health = 10f; [SerializeField] public float Energy = 10f; + protected FloatingTextSpawner TextPopUp; private Player Player { get { return Player.Instance; } } @@ -56,6 +57,8 @@ public class Gobler : Alive { Rigidbody = Owner.GetComponent(); Materials = Owner.GetComponentsInChildren().Select(x => x.material).ToList(); + TextPopUp = new FloatingTextSpawner(Owner.transform, 1); + SetState(State.GoToCrystal); EnemyManagers[Enemies.Gobler].UpdateTick += Update; EnemyManagers[Enemies.Gobler].GizmoTick += OnDrawGizmos; @@ -173,6 +176,7 @@ public class Gobler : Alive { case State.TakeDamage: PathAgent.isStopped = true; + TextPopUp.SpawnFloatingText(DamageTaken.ToString(), Color.red, 3); Materials.ForEach(x => x.SetColor("_FlashColor", Color.white)); break; diff --git a/Assets/Scripts/Runtime/Characters/Player/Classes/ClassBase.cs b/Assets/Scripts/Runtime/Characters/Player/Classes/ClassBase.cs index db58a11..e533d99 100644 --- a/Assets/Scripts/Runtime/Characters/Player/Classes/ClassBase.cs +++ b/Assets/Scripts/Runtime/Characters/Player/Classes/ClassBase.cs @@ -36,7 +36,7 @@ public class ClassBase { Player = player; Animator = Player.Animator; AttackAnimator = PlayerAttackAnimatorFactory.Instance; - TextPopUp = new FloatingTextSpawner(player.transform); + TextPopUp = new FloatingTextSpawner(player.transform, 0.5f); } virtual public void Tick() { @@ -98,13 +98,14 @@ public class ClassBase { protected Coroutine AttackCoroutine; - protected void CreateHitBoxOffset(float centerOffset, float radius, float hitDelay, float hitDuration, int knockback) { + protected void CreateHitBoxOffset(float centerOffset, float radius, float hitDelay, float hitDuration, int damage, int knockback) { if (AttackCoroutine != null) Player.Instance.StopCoroutine(AttackCoroutine); var center = PlayerPos + Player.PrevDirection * centerOffset; hitDelay = 0; HitBoxDraw.Knockback = knockback; HitBoxDraw.Directional = centerOffset != 0; + HitBoxDraw.Damage = damage; AttackCoroutine = Player.Instance.StartCoroutine(CreateHitBoxHelper(center, radius, hitDelay, hitDuration)); } @@ -134,5 +135,6 @@ public class ClassBase { public float Radius; public Color Color; public int Knockback; + public int Damage; } } diff --git a/Assets/Scripts/Runtime/Characters/Player/Classes/MeleeFighterClass.cs b/Assets/Scripts/Runtime/Characters/Player/Classes/MeleeFighterClass.cs index 3f1ff2d..afb3610 100644 --- a/Assets/Scripts/Runtime/Characters/Player/Classes/MeleeFighterClass.cs +++ b/Assets/Scripts/Runtime/Characters/Player/Classes/MeleeFighterClass.cs @@ -19,6 +19,9 @@ public class MeleeFighterClass : ClassBase { public float Cooldown; public bool TimesUp; + public int DamageMultiplier = 1; + public int DamageOffset = 0; + public VfxHandlerBase VfxKineticSurgeHandler { get { return Player.VfxKineticSurgeHandler; } } @@ -74,9 +77,9 @@ public class MeleeFighterClass : ClassBase { AttackAnimator?.MeleeResetKineticCharge(); AttackAnimator?.MeleeKineticSurge(); AnimationToPlay = "Attack1"; - TextPopUp.SpawnFloatingText("KineticSurge", Color.red, 3); + //TextPopUp.SpawnFloatingText("KineticSurge", Color.red, 3); AllowBladeVortex = ComboTimeElapsed <= 0.1f; - CreateHitBoxOffset(0, 5, 0.1f, 0.1f, 20); + CreateHitBoxOffset(0, 5, 0.1f, 0.1f, (10 * DamageMultiplier) + DamageOffset, 20); break; @@ -207,7 +210,7 @@ public class MeleeFighterClass : ClassBase { Player.MoveSpeedDampener = (state == AttackState.None) ? 1 : 1 / decreasedSpeed; if (state == AttackState.None) return; Cooldown = cooldown; - TextPopUp.SpawnFloatingText(state.ToString(), Color.red, 3); + //TextPopUp.SpawnFloatingText(state.ToString(), Color.red, 3); ComboResetTime = resetTime; LastComboTime = Time.time; @@ -224,7 +227,7 @@ public class MeleeFighterClass : ClassBase { case AttackState.Shockwave: AnimationToPlay = "Shockwave"; Player.VfxShockwavePool.Get(Player.transform.position); - CreateHitBoxOffset(0, 5, 0.1f, 0.1f, 20); + CreateHitBoxOffset(0, 5, 0.1f, 0.1f, (20 * DamageMultiplier) + DamageOffset, 20); Player.IsJumping = false; break; @@ -234,17 +237,17 @@ public class MeleeFighterClass : ClassBase { case AttackState.BasicAttack1: AnimationToPlay = "Attack1"; - CreateHitBoxOffset(4, 4, 0.1f, 0.1f, 10); + CreateHitBoxOffset(4, 4, 0.1f, 0.1f, (2 * DamageMultiplier) + DamageOffset, 10); break; case AttackState.BasicAttack2: AnimationToPlay = "Attack2"; - CreateHitBoxOffset(4, 4, 0.1f, 0.1f, 15); + CreateHitBoxOffset(4, 4, 0.1f, 0.1f, (4 * DamageMultiplier) + DamageOffset, 15); break; case AttackState.BasicAttack3: AnimationToPlay = "Attack1"; - CreateHitBoxOffset(4, 4, 0.1f, 0.1f, 20); + CreateHitBoxOffset(4, 4, 0.1f, 0.1f, (6 * DamageMultiplier) + DamageOffset, 20); break; case AttackState.KineticSurgeRelease: diff --git a/Assets/Scripts/Runtime/Characters/Player/Classes/PlayerAttackAnimatorFactory.cs b/Assets/Scripts/Runtime/Characters/Player/Classes/PlayerAttackAnimatorFactory.cs index d5ebc8e..2f93ce5 100644 --- a/Assets/Scripts/Runtime/Characters/Player/Classes/PlayerAttackAnimatorFactory.cs +++ b/Assets/Scripts/Runtime/Characters/Player/Classes/PlayerAttackAnimatorFactory.cs @@ -21,7 +21,7 @@ public class PlayerAttackAnimatorFactory : MonoBehaviour { public void Awake() { Instance = this; Player = GetComponentInParent(); - TextPopUp = new FloatingTextSpawner(this.transform); + TextPopUp = new FloatingTextSpawner(this.transform, 0.5f); BuildMeleeAnimationClips(); } diff --git a/Assets/Scripts/Runtime/Characters/Player/PlayerMainController.cs b/Assets/Scripts/Runtime/Characters/Player/PlayerMainController.cs index 79ca6d5..16215bb 100644 --- a/Assets/Scripts/Runtime/Characters/Player/PlayerMainController.cs +++ b/Assets/Scripts/Runtime/Characters/Player/PlayerMainController.cs @@ -204,7 +204,7 @@ public class Player : MonoBehaviour { GameObject parent = hit.transform.parent?.gameObject; Vector2 knockbakDirection = ActiveClass.HitBoxDraw.Directional ? PrevDirection : parent.transform.position - transform.position; - EnemySpawnerData.EnemyMap[parent].Damage(0, knockbakDirection, ActiveClass.HitBoxDraw.Knockback); + EnemySpawnerData.EnemyMap[parent].Damage(ActiveClass.HitBoxDraw.Damage, knockbakDirection, ActiveClass.HitBoxDraw.Knockback); } } diff --git a/Assets/Scripts/Runtime/Environment/FloatingTextSpawner.cs b/Assets/Scripts/Runtime/Environment/FloatingTextSpawner.cs index 66eb2ab..d926d23 100644 --- a/Assets/Scripts/Runtime/Environment/FloatingTextSpawner.cs +++ b/Assets/Scripts/Runtime/Environment/FloatingTextSpawner.cs @@ -8,10 +8,12 @@ using UnityEngine; public class FloatingTextSpawner { private static GameObject GameObjectContainer = new GameObject($"Floating Text Container"); private Transform Transform; + private float YOffset; private List TextList = new List(); - public FloatingTextSpawner(Transform transform) { + public FloatingTextSpawner(Transform transform, float yOffset) { Transform = transform; + YOffset = yOffset; } public void SpawnFloatingText(string message, Color color, float duration = 1.5f) { @@ -33,7 +35,7 @@ public class FloatingTextSpawner { renderer.sortingLayerName = "UI"; renderer.sortingOrder = 0; - textObj.AddComponent().Init(duration, ref TextList); + textObj.AddComponent().Init(duration, ref TextList, YOffset); UnityEngine.Object.Instantiate(textObj, GameObjectContainer.transform); } catch (Exception e) { } } @@ -47,7 +49,7 @@ public class FloatingText : MonoBehaviour { private TextMesh textMesh; - public void Init(float duration, ref List textList) { + public void Init(float duration, ref List textList, float yOffset) { try { lifetime = duration; textMesh = GetComponent(); @@ -57,7 +59,7 @@ public class FloatingText : MonoBehaviour { if (textList[i] == null) textList.RemoveAt(i); else - textList[i].position += Vector3.up * 0.5f; + textList[i].position += Vector3.up * yOffset; } textList.Add(this.transform);