From 6298c6bb1fc6455d6cf2c004c60291b5d1452066 Mon Sep 17 00:00:00 2001 From: Kim Taebum <39542671+scarleter99@users.noreply.github.com> Date: Mon, 13 May 2024 19:22:31 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20Alien=20=ED=83=80=EA=B2=A9=20=EC=8B=9C?= =?UTF-8?q?=20delay=20&=20Crew=20=ED=94=BC=EA=B2=A9=20=EC=8B=9C=20?= =?UTF-8?q?=EC=86=8D=EB=8F=84=20=EB=B6=80=EC=8A=A4=ED=8A=B8=20(#141)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: Alien 타격 시 delay * Crew 피격 시 속도 부스트 --- .../Resources/Datas/ExcelData/CrewData.csv | 1 - .../Resources/Datas/ExcelData/SkillData.csv | 4 +- .../Controllers/AlienAnimController.cs | 14 ++-- .../Controllers/CrewAnimController.cs | 1 - .../Scripts/Contents/Skills/BaseSkill.cs | 80 +++++++++++++------ .../Scripts/Contents/Skills/BasicAttack.cs | 23 ++---- .../Scripts/Contents/Skills/CursedHowl.cs | 2 +- .../Scripts/Contents/Skills/LeapAttack.cs | 25 ++---- Client/Assets/Scripts/Contents/Skills/Roar.cs | 39 +++++---- .../Assets/Scripts/Contents/Stats/CrewStat.cs | 8 ++ Client/Assets/Scripts/Creatures/Alien.cs | 2 +- Client/Assets/Scripts/Creatures/Crew.cs | 7 +- Client/Assets/Scripts/Utils/Define.cs | 3 +- 13 files changed, 115 insertions(+), 94 deletions(-) diff --git a/Client/Assets/Resources/Datas/ExcelData/CrewData.csv b/Client/Assets/Resources/Datas/ExcelData/CrewData.csv index 890ee3fe17..bb97c8a0c0 100644 --- a/Client/Assets/Resources/Datas/ExcelData/CrewData.csv +++ b/Client/Assets/Resources/Datas/ExcelData/CrewData.csv @@ -1,3 +1,2 @@ DataId,Name,WalkSpeed,RunSpeed,WorkSpeed,MaxHp,MaxStamina,MaxSanity,SitSpeed 101000,CrewA,80,110,10,3,100,100,40 -,,,,,,,, diff --git a/Client/Assets/Resources/Datas/ExcelData/SkillData.csv b/Client/Assets/Resources/Datas/ExcelData/SkillData.csv index c7498040ef..77033027d7 100644 --- a/Client/Assets/Resources/Datas/ExcelData/SkillData.csv +++ b/Client/Assets/Resources/Datas/ExcelData/SkillData.csv @@ -1,7 +1,5 @@ DataId,Name,CoolTime,Range,Damage,SanityDamage,TotalSkillAmount,TotalReadySkillAmount 301000,Basic Attack,2,1.5,1,20,1.2,-1 301001,Roar,10,10,-1,30,2.5,0.7 -301002,Cursed Howl,60,-1,-1,-1,3.5,0.7 +301002,Cursed Howl,60,-1,-1,-1,2.5,0.7 301003,Leap Attack,20,1.5,1,20,2,0.7 -,,,,,, -,,, diff --git a/Client/Assets/Scripts/Contents/Controllers/AlienAnimController.cs b/Client/Assets/Scripts/Contents/Controllers/AlienAnimController.cs index 99c36d852c..b3ebe2dcdd 100644 --- a/Client/Assets/Scripts/Contents/Controllers/AlienAnimController.cs +++ b/Client/Assets/Scripts/Contents/Controllers/AlienAnimController.cs @@ -1,5 +1,3 @@ -using UnityEngine; - public class AlienAnimController : BaseAnimController { #region Update @@ -77,6 +75,9 @@ public void PlayAnim(Define.AlienActionType alienActionType) case Define.AlienActionType.LeapAttack: PlayLeapAttack(); break; + case Define.AlienActionType.HitDelay: + PlayHitDelay(); + break; } } @@ -103,7 +104,6 @@ public void PlayReadyRoar() public void PlayRoar() { SetBool("Roar", true); - SetBool("ReadyRoar", false); } public void PlayReadyCursedHowl() @@ -114,7 +114,6 @@ public void PlayReadyCursedHowl() public void PlayCursedHowl() { SetBool("CursedHowl", true); - SetBool("ReadyRoar", false); } public void PlayReadyLeapAttack() @@ -125,7 +124,11 @@ public void PlayReadyLeapAttack() public void PlayLeapAttack() { SetBool("LeapAttack", true); - SetBool("ReadyLeapAttack", false); + } + + public void PlayHitDelay() + { + SetBool("HitDelay", true); } #endregion @@ -141,5 +144,6 @@ protected override void SetParameterFalse() SetBool("LeapAttack", false); SetBool("ReadyRoar", false); SetBool("ReadyLeapAttack", false); + SetBool("HitDelay", false); } } diff --git a/Client/Assets/Scripts/Contents/Controllers/CrewAnimController.cs b/Client/Assets/Scripts/Contents/Controllers/CrewAnimController.cs index d6bb31fa85..7aff3c76c4 100644 --- a/Client/Assets/Scripts/Contents/Controllers/CrewAnimController.cs +++ b/Client/Assets/Scripts/Contents/Controllers/CrewAnimController.cs @@ -1,4 +1,3 @@ -using UnityEngine; using Fusion; public class CrewAnimController : BaseAnimController diff --git a/Client/Assets/Scripts/Contents/Skills/BaseSkill.cs b/Client/Assets/Scripts/Contents/Skills/BaseSkill.cs index 294188ab21..95860c78ec 100644 --- a/Client/Assets/Scripts/Contents/Skills/BaseSkill.cs +++ b/Client/Assets/Scripts/Contents/Skills/BaseSkill.cs @@ -20,7 +20,7 @@ public abstract class BaseSkill : NetworkBehaviour public Alien Owner { get; protected set; } public Vector3 ForwardDirection => Owner.Transform.forward; - public Vector3 AttackPosition => Owner.Head.transform.position + Vector3.down * 0.2f; + public Vector3 AttackPosition { get; protected set; } private Tweener _coolTimeTweener; @@ -75,6 +75,24 @@ public void UseSkill() StartCoroutine(ProgressSkill()); } + protected IEnumerator ReadySkillProgress() + { + while (CurrentReadySkillAmount < SkillData.TotalReadySkillAmount) + { + CurrentReadySkillAmount = Mathf.Clamp(CurrentReadySkillAmount + Time.deltaTime, 0, SkillData.TotalReadySkillAmount); + Owner.IngameUI.WorkProgressBarUI.CurrentWorkAmount = CurrentReadySkillAmount; + + yield return null; + } + + UseSkill(); + } + + protected virtual IEnumerator ProgressSkill() + { + yield return null; + } + protected void UpdateWorkAmount() { CurrentSkillAmount = Mathf.Clamp(CurrentSkillAmount + Time.deltaTime, 0, SkillData.TotalSkillAmount); @@ -94,7 +112,26 @@ protected void Cooldown() }); } - public void SkillInterrupt() + protected virtual void DecideHit(float x, float y) + { + Ray ray = new Ray(AttackPosition + Owner.CameraRotationY * new Vector3(x, y, 0f), ForwardDirection); + + Debug.DrawRay(ray.origin, ray.direction * SkillData.Range, Color.red); + + if (Physics.Raycast(ray, out RaycastHit rayHit, maxDistance: SkillData.Range, + layerMask: LayerMask.GetMask("Crew", "MapObject", "PlanTargetObject"))) + { + if (rayHit.transform.gameObject.TryGetComponent(out Crew crew)) + { + IsHit = true; + Owner.AlienSoundController.PlaySound(Define.AlienActionType.Hit); + crew.Rpc_OnDamaged(SkillData.Damage); + crew.Rpc_OnSanityDamaged(SkillData.SanityDamage); + } + } + } + + public void SkillInterrupt(float hitDelayTime) { StopAllCoroutines(); @@ -103,11 +140,27 @@ public void SkillInterrupt() CurrentSkillAmount = 0f; CurrentReadySkillAmount = 0f; - IsHit = false; + if (IsHit) + { + HitDelay(hitDelayTime); + return; + } Owner.ReturnToIdle(0); } + protected void HitDelay(float time) + { + if (time > 0f) + { + Owner.AlienAnimController.PlayAnim(Define.AlienActionType.HitDelay); + Owner.AlienSoundController.PlaySound(Define.AlienActionType.HitDelay); + } + + IsHit = false; + Owner.ReturnToIdle(time); + } + protected void PlayAnim(bool isReady) { if (isReady) @@ -120,26 +173,5 @@ protected void PlaySound() { Owner.AlienSoundController.PlaySound(SkillActionType); } - - protected IEnumerator ReadySkillProgress() - { - while (CurrentReadySkillAmount < SkillData.TotalReadySkillAmount) - { - // if (Owner.CreatureState != Define.CreatureState.Use) - // SkillInterrupt(); - - CurrentReadySkillAmount = Mathf.Clamp(CurrentReadySkillAmount + Time.deltaTime, 0, SkillData.TotalReadySkillAmount); - Owner.IngameUI.WorkProgressBarUI.CurrentWorkAmount = CurrentReadySkillAmount; - - yield return null; - } - - UseSkill(); - } - - protected virtual IEnumerator ProgressSkill() - { - yield return null; - } } diff --git a/Client/Assets/Scripts/Contents/Skills/BasicAttack.cs b/Client/Assets/Scripts/Contents/Skills/BasicAttack.cs index a0451638b3..491c726338 100644 --- a/Client/Assets/Scripts/Contents/Skills/BasicAttack.cs +++ b/Client/Assets/Scripts/Contents/Skills/BasicAttack.cs @@ -28,29 +28,16 @@ protected override IEnumerator ProgressSkill() PlayAnim(false); PlaySound(); + AttackPosition = Owner.Head.transform.position + Vector3.down * 0.2f; while (CurrentSkillAmount < SkillData.TotalSkillAmount) { - if (CurrentSkillAmount > 0.3f && !IsHit) + if (CurrentSkillAmount > 0.3f && CurrentSkillAmount < 0.6f && !IsHit) { - for (float i = -1f; i <= 1f && !IsHit; i += 0.2f) + for (float i = -0.3f; i <= 0.3f && !IsHit; i += 0.2f) { for (float j = -1f; j <= 1f && !IsHit; j += 0.2f) { - Ray ray = new Ray(AttackPosition + Owner.CameraRotationY * new Vector3(i, j, 0f), ForwardDirection); - - Debug.DrawRay(ray.origin, ray.direction * SkillData.Range, Color.red); - - if (Physics.Raycast(ray, out RaycastHit rayHit, maxDistance: SkillData.Range, - layerMask: LayerMask.GetMask("Crew", "MapObject", "PlanTargetObject"))) - { - if (rayHit.transform.gameObject.TryGetComponent(out Crew crew)) - { - IsHit = true; - Owner.AlienSoundController.PlaySound(Define.AlienActionType.Hit); - crew.Rpc_OnDamaged(SkillData.Damage); - crew.Rpc_OnSanityDamaged(SkillData.SanityDamage); - } - } + DecideHit(i, j); } } } @@ -59,6 +46,6 @@ protected override IEnumerator ProgressSkill() yield return null; } - SkillInterrupt(); + SkillInterrupt(1.5f); } } diff --git a/Client/Assets/Scripts/Contents/Skills/CursedHowl.cs b/Client/Assets/Scripts/Contents/Skills/CursedHowl.cs index b79f7102d8..10502cad63 100644 --- a/Client/Assets/Scripts/Contents/Skills/CursedHowl.cs +++ b/Client/Assets/Scripts/Contents/Skills/CursedHowl.cs @@ -38,6 +38,6 @@ protected override IEnumerator ProgressSkill() yield return null; } - SkillInterrupt(); + SkillInterrupt(0f); } } diff --git a/Client/Assets/Scripts/Contents/Skills/LeapAttack.cs b/Client/Assets/Scripts/Contents/Skills/LeapAttack.cs index d614c9edd5..4c854f46f2 100644 --- a/Client/Assets/Scripts/Contents/Skills/LeapAttack.cs +++ b/Client/Assets/Scripts/Contents/Skills/LeapAttack.cs @@ -6,7 +6,7 @@ public class LeapAttack : BaseSkill { public SimpleKCC KCC => Owner.KCC; - public bool IsMoving { get; protected set; } + public bool IsMoving { get; protected set; } = false; public bool IsErosion => Managers.GameMng.MapSystem.Sectors[Owner.CurrentSector].IsErosion; public override void SetInfo(int templateId) @@ -15,8 +15,6 @@ public override void SetInfo(int templateId) ReadySkillActionType = Define.AlienActionType.ReadyLeapAttack; SkillActionType = Define.AlienActionType.LeapAttack; - - IsMoving = false; } public override bool CheckAndUseSkill() @@ -41,29 +39,16 @@ protected override IEnumerator ProgressSkill() PlayAnim(false); PlaySound(); + AttackPosition = Owner.Head.transform.position + Vector3.down * 0.2f; while (CurrentSkillAmount < SkillData.TotalSkillAmount) { if (CurrentSkillAmount < SkillData.TotalSkillAmount - 0.5f && !IsHit) { - for (float i = -1f; i <= 1f && !IsHit; i += 0.2f) + for (float i = -0.5f; i <= 0.5f && !IsHit; i += 0.2f) { for (float j = -1f; j <= 1f && !IsHit; j += 0.2f) { - Ray ray = new Ray(AttackPosition + Owner.CameraRotationY * new Vector3(i, j, 0f), ForwardDirection); - - Debug.DrawRay(ray.origin, ray.direction * SkillData.Range, Color.red); - - if (Physics.Raycast(ray, out RaycastHit rayHit, maxDistance: SkillData.Range, - layerMask: LayerMask.GetMask("Crew", "MapObject", "PlanTargetObject"))) - { - if (rayHit.transform.gameObject.TryGetComponent(out Crew crew)) - { - IsHit = true; - Owner.AlienSoundController.PlaySound(Define.AlienActionType.Hit); - crew.Rpc_OnDamaged(SkillData.Damage); - crew.Rpc_OnSanityDamaged(SkillData.SanityDamage); - } - } + DecideHit(i, j); } } } @@ -75,7 +60,7 @@ protected override IEnumerator ProgressSkill() } IsMoving = false; - SkillInterrupt(); + SkillInterrupt(1.5f); } public override void FixedUpdateNetwork() diff --git a/Client/Assets/Scripts/Contents/Skills/Roar.cs b/Client/Assets/Scripts/Contents/Skills/Roar.cs index b9829113ca..fbfe62abf3 100644 --- a/Client/Assets/Scripts/Contents/Skills/Roar.cs +++ b/Client/Assets/Scripts/Contents/Skills/Roar.cs @@ -16,27 +16,14 @@ protected override IEnumerator ProgressSkill() PlayAnim(false); PlaySound(); + AttackPosition = Owner.Head.transform.position + Vector3.down * 0.2f; while (CurrentSkillAmount < SkillData.TotalSkillAmount) { for (float i = -1.5f; i <= 1.5f && !IsHit; i += 0.2f) { - for (float j = -1.5f; j <= 1.5f && !IsHit; j += 0.2f) + for (float j = -1f; j <= 1f && !IsHit; j += 0.2f) { - Ray ray = new Ray(AttackPosition + Owner.CameraRotationY * new Vector3(i, j, 0f), ForwardDirection); - - Debug.DrawRay(ray.origin, ray.direction * SkillData.Range, Color.red); - - if (Physics.Raycast(ray, out RaycastHit rayHit, maxDistance: SkillData.Range, - layerMask: LayerMask.GetMask("Crew", "MapObject", "PlanTargetObject"))) - { - if (rayHit.transform.gameObject.TryGetComponent(out Crew crew)) - { - IsHit = true; - crew.Rpc_OnDamaged(SkillData.Damage); - crew.Rpc_OnSanityDamaged(SkillData.SanityDamage); - Owner.SkillController.Skills[2].CurrentCoolTime -= 20f; - } - } + DecideHit(i, j); } } @@ -44,6 +31,24 @@ protected override IEnumerator ProgressSkill() yield return null; } - SkillInterrupt(); + SkillInterrupt(0f); + } + + protected override void DecideHit(float x, float y) + { + Ray ray = new Ray(AttackPosition + Owner.CameraRotationY * new Vector3(x, y, 0f), ForwardDirection); + + Debug.DrawRay(ray.origin, ray.direction * SkillData.Range, Color.red); + + if (Physics.Raycast(ray, out RaycastHit rayHit, maxDistance: SkillData.Range, + layerMask: LayerMask.GetMask("Crew", "MapObject", "PlanTargetObject"))) + { + if (rayHit.transform.gameObject.TryGetComponent(out Crew crew)) + { + IsHit = true; + crew.Rpc_OnSanityDamaged(SkillData.SanityDamage); + Owner.SkillController.Skills[2].CurrentCoolTime -= 20f; + } + } } } diff --git a/Client/Assets/Scripts/Contents/Stats/CrewStat.cs b/Client/Assets/Scripts/Contents/Stats/CrewStat.cs index cee571c0cf..4b55f9f107 100644 --- a/Client/Assets/Scripts/Contents/Stats/CrewStat.cs +++ b/Client/Assets/Scripts/Contents/Stats/CrewStat.cs @@ -1,4 +1,5 @@ using Data; +using DG.Tweening; using UnityEngine; public class CrewStat : BaseStat @@ -16,6 +17,7 @@ public class CrewStat : BaseStat public bool IsRunnable { get; set; } = true; public bool Exhausted { get; set; } = false; public bool Doped { get; set; } = false; + public bool DamagedBoost { get; set; } = false; public override void SetStat(CreatureData creatureData) { @@ -42,6 +44,12 @@ public void ChangeHp(int value) if (value < 0) { Managers.GameMng.RenderingSystem.DamageEffect(Hp); + + DamagedBoost = true; + DOVirtual.DelayedCall(3.5f, () => + { + DamagedBoost = false; + }); } } diff --git a/Client/Assets/Scripts/Creatures/Alien.cs b/Client/Assets/Scripts/Creatures/Alien.cs index ca7230dbb7..41a3af768d 100644 --- a/Client/Assets/Scripts/Creatures/Alien.cs +++ b/Client/Assets/Scripts/Creatures/Alien.cs @@ -151,7 +151,7 @@ protected override void UpdateMove() KCC.SetLookRotation(0, CreatureCamera.transform.rotation.eulerAngles.y); - KCC.Move(Velocity * (AlienStat.Speed * Runner.DeltaTime), 0f); + KCC.Move(Velocity * (AlienStat.Speed * Runner.DeltaTime)); } protected bool CheckAndUseSkill(int skillIdx) diff --git a/Client/Assets/Scripts/Creatures/Crew.cs b/Client/Assets/Scripts/Creatures/Crew.cs index 835f58658c..02e831fae3 100644 --- a/Client/Assets/Scripts/Creatures/Crew.cs +++ b/Client/Assets/Scripts/Creatures/Crew.cs @@ -128,7 +128,7 @@ protected override void HandleInput() if (CreatureState == Define.CreatureState.Interact || CreatureState == Define.CreatureState.Use) { if (Input.GetKeyDown(KeyCode.F)) - CreatureState = Define.CreatureState.Idle; + ReturnToIdle(0f); return; } @@ -249,9 +249,12 @@ protected override void UpdateMove() break; } + if (CrewStat.DamagedBoost) + CrewStat.Speed *= 1.5f; + KCC.SetLookRotation(0, CreatureCamera.transform.rotation.eulerAngles.y); - KCC.Move(Velocity * (CrewStat.Speed * Runner.DeltaTime), 0f); + KCC.Move(Velocity * (CrewStat.Speed * Runner.DeltaTime)); } protected bool CheckAndUseItem() diff --git a/Client/Assets/Scripts/Utils/Define.cs b/Client/Assets/Scripts/Utils/Define.cs index 5fd5e03566..0a93aba32b 100644 --- a/Client/Assets/Scripts/Utils/Define.cs +++ b/Client/Assets/Scripts/Utils/Define.cs @@ -40,6 +40,7 @@ public enum AlienActionType CursedHowl, ReadyLeapAttack, LeapAttack, + HitDelay, } public enum SectorName @@ -204,7 +205,7 @@ public enum CameraMode public const int MAX_SKILL_NUM = 4; public const float PASIVE_RECOVER_STAMINA = 2f; - public const float DAMAGED_RECOVER_STAMINA = 60f; + public const float DAMAGED_RECOVER_STAMINA = 30f; public const float RUN_USE_STAMINA = 5f; public const float EROSION_REDUCE_SANITY = 1f; public const float SIT_RECOVER_SANITY = 1f;