#165 전투 플레이어 및 보스 보완 작업
+ 전투 플레이어도 피격시 FlashWhite 기능이 추가되었습니다. + 전투 플레이어의 기본 속도 10 -> 7로 변경했습니다. + 보스 및 잡몹의 Collider를 통과할 수 있게 변경했습니다. + 보스의 스킬에 피격되면 튕겨내는 기능을 추가했습니다. + 코뿔소 스킬(EarthquakeWave)가 표시하는 것과 다르게 공격하는 오류를 수정했습니다.
This commit is contained in:
parent
7b4408247e
commit
5f99f52b4b
@ -876255,11 +876255,6 @@ PrefabInstance:
|
|||||||
propertyPath: m_TagString
|
propertyPath: m_TagString
|
||||||
value: CombatPlayer
|
value: CombatPlayer
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 7729150195808218711, guid: d9472bd7185627847ae4d5b1d3d3bb8a,
|
|
||||||
type: 3}
|
|
||||||
propertyPath: m_Mass
|
|
||||||
value: 10
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 8934240191915016273, guid: d9472bd7185627847ae4d5b1d3d3bb8a,
|
- target: {fileID: 8934240191915016273, guid: d9472bd7185627847ae4d5b1d3d3bb8a,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: m_LocalPosition.x
|
propertyPath: m_LocalPosition.x
|
||||||
|
@ -19,6 +19,7 @@ namespace BlueWaterProject
|
|||||||
{
|
{
|
||||||
public PlayerInput playerInput;
|
public PlayerInput playerInput;
|
||||||
public Transform visualLook;
|
public Transform visualLook;
|
||||||
|
public SpriteRenderer spriteRenderer;
|
||||||
public Animator animator;
|
public Animator animator;
|
||||||
public PhysicsMovement movement;
|
public PhysicsMovement movement;
|
||||||
}
|
}
|
||||||
@ -33,8 +34,11 @@ namespace BlueWaterProject
|
|||||||
[Range(1, 21), Tooltip("한 번에 공격 가능한 개체 수")]
|
[Range(1, 21), Tooltip("한 번에 공격 가능한 개체 수")]
|
||||||
public int maxHitNum = 10;
|
public int maxHitNum = 10;
|
||||||
|
|
||||||
[Range(0f, 100f), Tooltip("공격 데미지")]
|
[Range(0f, 100f), Tooltip("첫 번째 공격 데미지")]
|
||||||
public float attackDamage = 10f;
|
public float firstAttackDamage = 10f;
|
||||||
|
|
||||||
|
[Range(0f, 100f), Tooltip("두 번째 공격 데미지")]
|
||||||
|
public float secondAttackDamage = 15f;
|
||||||
|
|
||||||
[Range(0.1f, 2f), Tooltip("콤보 공격 포함 총 걸리는 시간")]
|
[Range(0.1f, 2f), Tooltip("콤보 공격 포함 총 걸리는 시간")]
|
||||||
public float attackTime = 0.7f;
|
public float attackTime = 0.7f;
|
||||||
@ -64,7 +68,6 @@ namespace BlueWaterProject
|
|||||||
public bool isUsingSkill;
|
public bool isUsingSkill;
|
||||||
}
|
}
|
||||||
|
|
||||||
[DisableIf("@true")]
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class CurrentValue
|
public class CurrentValue
|
||||||
{
|
{
|
||||||
@ -105,6 +108,8 @@ namespace BlueWaterProject
|
|||||||
public static readonly int IsAttackingHash = Animator.StringToHash("isAttacking");
|
public static readonly int IsAttackingHash = Animator.StringToHash("isAttacking");
|
||||||
public static readonly int IsActivateMainSkillHash = Animator.StringToHash("isActivateMainSkill");
|
public static readonly int IsActivateMainSkillHash = Animator.StringToHash("isActivateMainSkill");
|
||||||
|
|
||||||
|
private static readonly int IsHitHash = Shader.PropertyToID("_IsHit");
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
@ -247,6 +252,8 @@ namespace BlueWaterProject
|
|||||||
Die();
|
Die();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StartCoroutine(nameof(FlashWhiteCoroutine));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Die()
|
public void Die()
|
||||||
@ -318,13 +325,13 @@ namespace BlueWaterProject
|
|||||||
if (isComboAttacked && MyComponents.animator.GetCurrentAnimatorStateInfo(0).normalizedTime >= attackTimingNormalized[1])
|
if (isComboAttacked && MyComponents.animator.GetCurrentAnimatorStateInfo(0).normalizedTime >= attackTimingNormalized[1])
|
||||||
{
|
{
|
||||||
MoveToCurrentDirection(10f);
|
MoveToCurrentDirection(10f);
|
||||||
AttackTiming();
|
AttackTiming(MyCharacterOption.secondAttackDamage);
|
||||||
isAttacked = true;
|
isAttacked = true;
|
||||||
}
|
}
|
||||||
else if (!isComboAttacked && MyComponents.animator.GetCurrentAnimatorStateInfo(0).normalizedTime >= attackTimingNormalized[0])
|
else if (!isComboAttacked && MyComponents.animator.GetCurrentAnimatorStateInfo(0).normalizedTime >= attackTimingNormalized[0])
|
||||||
{
|
{
|
||||||
MoveToCurrentDirection(1f);
|
MoveToCurrentDirection(1f);
|
||||||
AttackTiming();
|
AttackTiming(MyCharacterOption.firstAttackDamage);
|
||||||
isAttacked = true;
|
isAttacked = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -350,10 +357,10 @@ namespace BlueWaterProject
|
|||||||
CancelComboAttack();
|
CancelComboAttack();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AttackTiming()
|
public void AttackTiming(float damage)
|
||||||
{
|
{
|
||||||
var attackDirection = MyComponents.movement.GetPreviousMoveDirection();
|
var attackDirection = MyComponents.movement.GetPreviousMoveDirection();
|
||||||
var size = Physics.OverlapSphereNonAlloc(transform.position, MyCharacterOption.attackRange, MyCurrentValue.hitColliders, MyCharacterOption.targetLayer);
|
var size = Physics.OverlapSphereNonAlloc(transform.position, MyCharacterOption.attackRange, MyCurrentValue.hitColliders, MyCharacterOption.targetLayer, QueryTriggerInteraction.Collide);
|
||||||
|
|
||||||
for (var i = 0; i < size; i++)
|
for (var i = 0; i < size; i++)
|
||||||
{
|
{
|
||||||
@ -365,7 +372,7 @@ namespace BlueWaterProject
|
|||||||
if (MyCurrentValue.hitColliders[i].gameObject.layer == LayerMask.NameToLayer("Enemy"))
|
if (MyCurrentValue.hitColliders[i].gameObject.layer == LayerMask.NameToLayer("Enemy"))
|
||||||
{
|
{
|
||||||
var iDamageable = MyCurrentValue.hitColliders[i].transform.GetComponent<IDamageable>();
|
var iDamageable = MyCurrentValue.hitColliders[i].transform.GetComponent<IDamageable>();
|
||||||
iDamageable.TakeDamage(MyCharacterOption.attackDamage);
|
iDamageable?.TakeDamage(damage);
|
||||||
|
|
||||||
if (MyCurrentState.isComboAttacking)
|
if (MyCurrentState.isComboAttacking)
|
||||||
{
|
{
|
||||||
@ -376,7 +383,7 @@ namespace BlueWaterProject
|
|||||||
MyCurrentValue.hitColliders[i].CompareTag("DestructiveSkill"))
|
MyCurrentValue.hitColliders[i].CompareTag("DestructiveSkill"))
|
||||||
{
|
{
|
||||||
var iDamageable = MyCurrentValue.hitColliders[i].transform.GetComponent<IDamageable>();
|
var iDamageable = MyCurrentValue.hitColliders[i].transform.GetComponent<IDamageable>();
|
||||||
iDamageable.TakeDamage(MyCharacterOption.attackDamage);
|
iDamageable?.TakeDamage(damage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -416,6 +423,19 @@ namespace BlueWaterProject
|
|||||||
MyComponents.visualLook.localScale = localScale;
|
MyComponents.visualLook.localScale = localScale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private IEnumerator FlashWhiteCoroutine()
|
||||||
|
{
|
||||||
|
var spriteRenderer = MyComponents.spriteRenderer;
|
||||||
|
|
||||||
|
for (var i = 0; i < 5; i++)
|
||||||
|
{
|
||||||
|
spriteRenderer.material.SetInt(IsHitHash, 1);
|
||||||
|
yield return new WaitForSeconds(0.05f);
|
||||||
|
spriteRenderer.material.SetInt(IsHitHash, 0);
|
||||||
|
yield return new WaitForSeconds(0.05f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void CoolDown(float waitTime, Action onCooldownComplete = null)
|
public void CoolDown(float waitTime, Action onCooldownComplete = null)
|
||||||
{
|
{
|
||||||
StartCoroutine(CoolDownCoroutine(waitTime, onCooldownComplete));
|
StartCoroutine(CoolDownCoroutine(waitTime, onCooldownComplete));
|
||||||
|
@ -6,7 +6,7 @@ using UnityEngine.InputSystem;
|
|||||||
// ReSharper disable once CheckNamespace
|
// ReSharper disable once CheckNamespace
|
||||||
namespace BlueWaterProject
|
namespace BlueWaterProject
|
||||||
{
|
{
|
||||||
public class PhysicsMovement : MonoBehaviour, IStun
|
public class PhysicsMovement : MonoBehaviour, ICombatable
|
||||||
{
|
{
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* Definitions
|
* Definitions
|
||||||
@ -120,12 +120,6 @@ namespace BlueWaterProject
|
|||||||
[Title("효과")]
|
[Title("효과")]
|
||||||
[SerializeField] private ParticleSystem stunParticle;
|
[SerializeField] private ParticleSystem stunParticle;
|
||||||
|
|
||||||
public bool IsStunned
|
|
||||||
{
|
|
||||||
get => MyCurrentState.isStunned;
|
|
||||||
set => MyCurrentState.isStunned = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Vector3 CapsuleTop => MyComponents.rb.position + (MyComponents.capsuleCollider.center +
|
private Vector3 CapsuleTop => MyComponents.rb.position + (MyComponents.capsuleCollider.center +
|
||||||
Vector3.up * (MyComponents.capsuleCollider.height * 0.5f - MyComponents.capsuleCollider.radius))
|
Vector3.up * (MyComponents.capsuleCollider.height * 0.5f - MyComponents.capsuleCollider.radius))
|
||||||
* transform.localScale.x;
|
* transform.localScale.x;
|
||||||
@ -153,7 +147,7 @@ namespace BlueWaterProject
|
|||||||
|
|
||||||
private void FixedUpdate()
|
private void FixedUpdate()
|
||||||
{
|
{
|
||||||
if (!MyCurrentState.enableMoving || IsStunned) return;
|
if (!MyCurrentState.enableMoving || MyCurrentState.isStunned) return;
|
||||||
|
|
||||||
InputMove();
|
InputMove();
|
||||||
CheckGround();
|
CheckGround();
|
||||||
@ -211,11 +205,28 @@ namespace BlueWaterProject
|
|||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
#region Interfaces
|
#region Interfaces
|
||||||
|
|
||||||
|
public void DisableMove(float time)
|
||||||
|
{
|
||||||
|
if (MyCurrentState.isDashing) return;
|
||||||
|
|
||||||
|
MyCurrentState.enableMoving = false;
|
||||||
|
MyComponents.rb.velocity = Vector3.zero;
|
||||||
|
MyCurrentState.isMoving = false;
|
||||||
|
|
||||||
|
StartCoroutine(Utils.CoolDown(time, StopDisableMove));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void StopDisableMove()
|
||||||
|
{
|
||||||
|
MyComponents.rb.velocity = Vector3.zero;
|
||||||
|
MyCurrentState.enableMoving = true;
|
||||||
|
}
|
||||||
|
|
||||||
public void Stun(float stunTime)
|
public void Stun(float stunTime)
|
||||||
{
|
{
|
||||||
if (MyCurrentState.isDashing) return;
|
if (MyCurrentState.isDashing) return;
|
||||||
|
|
||||||
IsStunned = true;
|
MyCurrentState.isStunned = true;
|
||||||
MyComponents.rb.velocity = Vector3.zero;
|
MyComponents.rb.velocity = Vector3.zero;
|
||||||
MyCurrentState.isMoving = false;
|
MyCurrentState.isMoving = false;
|
||||||
|
|
||||||
@ -227,13 +238,20 @@ namespace BlueWaterProject
|
|||||||
StartCoroutine(Utils.CoolDown(stunTime, StopStun));
|
StartCoroutine(Utils.CoolDown(stunTime, StopStun));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void StopStun()
|
public void AddForceToDirection(Vector3 direction, float power)
|
||||||
|
{
|
||||||
|
if (MyCurrentState.isDashing) return;
|
||||||
|
|
||||||
|
MyComponents.rb.AddForce(direction * power, ForceMode.Impulse);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void StopStun()
|
||||||
{
|
{
|
||||||
if (stunParticle)
|
if (stunParticle)
|
||||||
{
|
{
|
||||||
stunParticle.Stop();
|
stunParticle.Stop();
|
||||||
}
|
}
|
||||||
IsStunned = false;
|
MyCurrentState.isStunned = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -89,6 +89,11 @@ namespace BlueWaterProject
|
|||||||
{
|
{
|
||||||
Destroy(element);
|
Destroy(element);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (UiManager.Inst.CombatUi.FieldBossHpSlider.gameObject.activeSelf)
|
||||||
|
{
|
||||||
|
UiManager.Inst.CombatUi.FieldBossHpSlider.SetActiveHpSlider(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,8 +191,9 @@ namespace BlueWaterProject
|
|||||||
|
|
||||||
public void MoveTarget(float stoppingDistance)
|
public void MoveTarget(float stoppingDistance)
|
||||||
{
|
{
|
||||||
if (agent)
|
if (agent && agent.enabled)
|
||||||
{
|
{
|
||||||
|
//rb.isKinematic = true;
|
||||||
agent.isStopped = false;
|
agent.isStopped = false;
|
||||||
agent.stoppingDistance = stoppingDistance;
|
agent.stoppingDistance = stoppingDistance;
|
||||||
agent.SetDestination(Target.transform.position);
|
agent.SetDestination(Target.transform.position);
|
||||||
@ -197,7 +203,7 @@ namespace BlueWaterProject
|
|||||||
public bool HasReachedDestination(float limitMovingTime)
|
public bool HasReachedDestination(float limitMovingTime)
|
||||||
{
|
{
|
||||||
// 경로 계산 중이면 false
|
// 경로 계산 중이면 false
|
||||||
if (!agent || agent.pathPending)
|
if (!agent || !agent.enabled || agent.pathPending)
|
||||||
{
|
{
|
||||||
departureTime = -1f;
|
departureTime = -1f;
|
||||||
return false;
|
return false;
|
||||||
@ -210,7 +216,9 @@ namespace BlueWaterProject
|
|||||||
|
|
||||||
if (departureTime > 0f && Time.time - departureTime >= limitMovingTime)
|
if (departureTime > 0f && Time.time - departureTime >= limitMovingTime)
|
||||||
{
|
{
|
||||||
|
agent.velocity = Vector3.zero;
|
||||||
agent.isStopped = true;
|
agent.isStopped = true;
|
||||||
|
//rb.isKinematic = false;
|
||||||
departureTime = -1f;
|
departureTime = -1f;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -223,6 +231,7 @@ namespace BlueWaterProject
|
|||||||
|
|
||||||
agent.velocity = Vector3.zero;
|
agent.velocity = Vector3.zero;
|
||||||
agent.isStopped = true;
|
agent.isStopped = true;
|
||||||
|
//rb.isKinematic = false;
|
||||||
departureTime = -1f;
|
departureTime = -1f;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
using System;
|
|
||||||
using Sirenix.OdinInspector;
|
using Sirenix.OdinInspector;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
|
13
BlueWater/Assets/02.Scripts/Interface/ICombatable.cs
Normal file
13
BlueWater/Assets/02.Scripts/Interface/ICombatable.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
// ReSharper disable once CheckNamespace
|
||||||
|
namespace BlueWaterProject
|
||||||
|
{
|
||||||
|
public interface ICombatable
|
||||||
|
{
|
||||||
|
void DisableMove(float time);
|
||||||
|
void Stun(float stunTime);
|
||||||
|
void StopStun();
|
||||||
|
void AddForceToDirection(Vector3 direction, float power);
|
||||||
|
}
|
||||||
|
}
|
@ -1,9 +0,0 @@
|
|||||||
// ReSharper disable once CheckNamespace
|
|
||||||
namespace BlueWaterProject
|
|
||||||
{
|
|
||||||
public interface IStun
|
|
||||||
{
|
|
||||||
bool IsStunned { get; set; }
|
|
||||||
void Stun(float stunTime);
|
|
||||||
}
|
|
||||||
}
|
|
@ -23,10 +23,8 @@ namespace RhinocerosSkill
|
|||||||
if (!isDrawingGizmo || !isUsingSkill) return;
|
if (!isDrawingGizmo || !isUsingSkill) return;
|
||||||
|
|
||||||
Gizmos.color = Color.red;
|
Gizmos.color = Color.red;
|
||||||
|
Gizmos.matrix = Matrix4x4.TRS(startPosition, transform.rotation, Vector3.one);
|
||||||
var rotation = Quaternion.LookRotation(new Vector3(SkillInputData.PreviousDirection.x, 0, SkillInputData.PreviousDirection.z));
|
Gizmos.DrawWireCube(Vector3.zero, halfScale * 2f);
|
||||||
Gizmos.matrix = Matrix4x4.TRS(startPosition + SkillInputData.PreviousDirection * Range * 0.5f, rotation, Vector3.one);
|
|
||||||
Gizmos.DrawWireCube(Vector3.zero, new Vector3(halfScale.x * 2, halfScale.y * 2, Range));
|
|
||||||
Gizmos.matrix = Matrix4x4.identity;
|
Gizmos.matrix = Matrix4x4.identity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,14 +52,15 @@ namespace RhinocerosSkill
|
|||||||
private IEnumerator SkillCoroutine(params Action[] actions)
|
private IEnumerator SkillCoroutine(params Action[] actions)
|
||||||
{
|
{
|
||||||
isUsingSkill = true;
|
isUsingSkill = true;
|
||||||
startPosition = SkillInputData.PlayerRb.position;
|
|
||||||
halfScale = transform.localScale * 0.5f;
|
|
||||||
|
|
||||||
transform.position = startPosition;
|
transform.position = SkillInputData.PlayerRb.position;
|
||||||
var angle = Mathf.Atan2(SkillInputData.PreviousDirection.x, SkillInputData.PreviousDirection.z) * Mathf.Rad2Deg;
|
var angle = Mathf.Atan2(SkillInputData.PreviousDirection.x, SkillInputData.PreviousDirection.z) * Mathf.Rad2Deg;
|
||||||
transform.rotation = Quaternion.Euler(0, angle, 0);
|
transform.rotation = Quaternion.Euler(0, angle, 0);
|
||||||
transform.localScale = new Vector3(width, 6f, Range * 2);
|
transform.localScale = new Vector3(width, 6f, Range * 2);
|
||||||
|
|
||||||
|
var myLocalScale = transform.localScale;
|
||||||
|
halfScale = new Vector3(myLocalScale.x * 0.5f, myLocalScale.y * 0.5f, myLocalScale.z * 0.25f);
|
||||||
|
|
||||||
ShowIndicator();
|
ShowIndicator();
|
||||||
|
|
||||||
var elapsedTime = 0f;
|
var elapsedTime = 0f;
|
||||||
@ -79,12 +78,20 @@ namespace RhinocerosSkill
|
|||||||
yield return null;
|
yield return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var maxSize = Physics.BoxCastNonAlloc(startPosition, halfScale, SkillInputData.PreviousDirection,
|
startPosition = transform.position + transform.forward * halfScale.z;
|
||||||
hits, Quaternion.identity, 0f, SkillInputData.TargetLayer, QueryTriggerInteraction.Ignore);
|
var maxSize = Physics.BoxCastNonAlloc(startPosition, halfScale, transform.forward,
|
||||||
|
hits, transform.rotation, 0f, SkillInputData.TargetLayer, QueryTriggerInteraction.Ignore);
|
||||||
for (var i = 0; i < maxSize; i++)
|
for (var i = 0; i < maxSize; i++)
|
||||||
{
|
{
|
||||||
var iDamageable = hits[i].transform.GetComponent<IDamageable>();
|
var iDamageable = hits[i].transform.GetComponent<IDamageable>();
|
||||||
iDamageable?.TakeDamage(Damage);
|
iDamageable?.TakeDamage(Damage);
|
||||||
|
|
||||||
|
var iCombatable = hits[i].transform.GetComponent<ICombatable>();
|
||||||
|
if (iCombatable != null)
|
||||||
|
{
|
||||||
|
iCombatable.DisableMove(0.2f);
|
||||||
|
iCombatable.AddForceToDirection(transform.forward, 10f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HideIndicator();
|
HideIndicator();
|
||||||
|
@ -47,7 +47,7 @@ namespace RhinocerosSkill
|
|||||||
var targetPosition = SkillInputData.TargetCollider.transform.position;
|
var targetPosition = SkillInputData.TargetCollider.transform.position;
|
||||||
var targetToDirection = (targetPosition - skillPlayerPosition).normalized;
|
var targetToDirection = (targetPosition - skillPlayerPosition).normalized;
|
||||||
transform.position = skillPlayerPosition + targetToDirection * hammerOffset;
|
transform.position = skillPlayerPosition + targetToDirection * hammerOffset;
|
||||||
transform.localScale = Vector3.one * Range;
|
transform.localScale = Vector3.one * (Range * 2f);
|
||||||
|
|
||||||
actions[1].Invoke();
|
actions[1].Invoke();
|
||||||
ShowIndicator();
|
ShowIndicator();
|
||||||
@ -72,6 +72,16 @@ namespace RhinocerosSkill
|
|||||||
{
|
{
|
||||||
var iDamageable = hitColliders[i].GetComponent<IDamageable>();
|
var iDamageable = hitColliders[i].GetComponent<IDamageable>();
|
||||||
iDamageable?.TakeDamage(Damage);
|
iDamageable?.TakeDamage(Damage);
|
||||||
|
|
||||||
|
var iCombatable = hitColliders[i].GetComponent<ICombatable>();
|
||||||
|
if (iCombatable != null)
|
||||||
|
{
|
||||||
|
var targetToVector = hitColliders[i].transform.position - transform.position;
|
||||||
|
targetToVector.y = 0f;
|
||||||
|
var direction = targetToVector.normalized;
|
||||||
|
iCombatable.DisableMove(0.3f);
|
||||||
|
iCombatable.AddForceToDirection(direction, 7f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HideIndicator();
|
HideIndicator();
|
||||||
|
@ -83,11 +83,13 @@ namespace RhinocerosSkill
|
|||||||
isUsingSkill = true;
|
isUsingSkill = true;
|
||||||
var skillPlayerPosition = SkillInputData.PlayerRb.position;
|
var skillPlayerPosition = SkillInputData.PlayerRb.position;
|
||||||
var targetPosition = SkillInputData.TargetCollider.transform.position;
|
var targetPosition = SkillInputData.TargetCollider.transform.position;
|
||||||
var targetToDirection = (targetPosition - skillPlayerPosition).normalized;
|
var targetToVector = targetPosition - skillPlayerPosition;
|
||||||
|
targetToVector.y = 0f;
|
||||||
|
var targetToDirection = targetToVector.normalized;
|
||||||
transform.position = skillPlayerPosition;
|
transform.position = skillPlayerPosition;
|
||||||
var yAngle = Mathf.Atan2(targetToDirection.x, targetToDirection.z) * Mathf.Rad2Deg;
|
var yAngle = Mathf.Atan2(targetToDirection.x, targetToDirection.z) * Mathf.Rad2Deg;
|
||||||
transform.rotation = Quaternion.Euler(0, yAngle, 0);
|
transform.rotation = Quaternion.Euler(0, yAngle, 0);
|
||||||
transform.localScale = Vector3.one * (Range * 2);
|
transform.localScale = Vector3.one * (Range * 2f);
|
||||||
|
|
||||||
actions[1].Invoke();
|
actions[1].Invoke();
|
||||||
ShowIndicator();
|
ShowIndicator();
|
||||||
@ -110,12 +112,22 @@ namespace RhinocerosSkill
|
|||||||
var maxSize = Physics.OverlapSphereNonAlloc(transform.position, Range, hitColliders, SkillInputData.TargetLayer);
|
var maxSize = Physics.OverlapSphereNonAlloc(transform.position, Range, hitColliders, SkillInputData.TargetLayer);
|
||||||
for (var i = 0; i < maxSize; i++)
|
for (var i = 0; i < maxSize; i++)
|
||||||
{
|
{
|
||||||
var angleToTarget = Vector3.Angle(skillPlayerPosition, transform.forward);
|
var hitToVector = hitColliders[i].transform.position - transform.position;
|
||||||
|
hitToVector.y = 0f;
|
||||||
|
var attackDirection = hitToVector.normalized;
|
||||||
|
var angleToTarget = Vector3.Angle(attackDirection, targetToDirection);
|
||||||
|
|
||||||
if (angleToTarget <= angle * 0.5f)
|
if (angleToTarget <= angle * 0.5f)
|
||||||
{
|
{
|
||||||
var iDamageable = hitColliders[i].GetComponent<IDamageable>();
|
var iDamageable = hitColliders[i].GetComponent<IDamageable>();
|
||||||
iDamageable?.TakeDamage(Damage);
|
iDamageable?.TakeDamage(Damage);
|
||||||
|
|
||||||
|
var iCombatable = hitColliders[i].GetComponent<ICombatable>();
|
||||||
|
if (iCombatable != null)
|
||||||
|
{
|
||||||
|
iCombatable.DisableMove(0.2f);
|
||||||
|
iCombatable.AddForceToDirection(attackDirection, 10f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ namespace RhinocerosSkill
|
|||||||
{
|
{
|
||||||
if (SkillInputData.TargetCollider)
|
if (SkillInputData.TargetCollider)
|
||||||
{
|
{
|
||||||
SkillInputData.TargetCollider.GetComponent<IStun>().IsStunned = false;
|
SkillInputData.TargetCollider.GetComponent<ICombatable>().StopStun();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,7 +117,7 @@ namespace RhinocerosSkill
|
|||||||
SkillInputData.PlayerRb.useGravity = false;
|
SkillInputData.PlayerRb.useGravity = false;
|
||||||
|
|
||||||
var elapsedTime = 0f;
|
var elapsedTime = 0f;
|
||||||
var startPosition = SkillInputData.PlayerRb.transform.position;
|
var startPosition = SkillInputData.PlayerRb.position;
|
||||||
var endPosition = startPosition + Vector3.up * 15f;
|
var endPosition = startPosition + Vector3.up * 15f;
|
||||||
|
|
||||||
while (elapsedTime < upTime)
|
while (elapsedTime < upTime)
|
||||||
@ -165,7 +165,7 @@ namespace RhinocerosSkill
|
|||||||
yield return null;
|
yield return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
IgnoreCollision(true);
|
//IgnoreCollision(true);
|
||||||
|
|
||||||
elapsedTime = 0f;
|
elapsedTime = 0f;
|
||||||
while (elapsedTime < downTime)
|
while (elapsedTime < downTime)
|
||||||
@ -183,22 +183,6 @@ namespace RhinocerosSkill
|
|||||||
|
|
||||||
SkillInputData.PlayerRb.position = endPosition;
|
SkillInputData.PlayerRb.position = endPosition;
|
||||||
|
|
||||||
var targetToVector = SkillInputData.TargetCollider.transform.position - SkillInputData.PlayerCollider.transform.position;
|
|
||||||
targetToVector.y = 0f;
|
|
||||||
var playerRadius = ((CapsuleCollider)SkillInputData.PlayerCollider).radius;
|
|
||||||
|
|
||||||
if (targetToVector.magnitude < playerRadius)
|
|
||||||
{
|
|
||||||
var direction = targetToVector.normalized;
|
|
||||||
direction = direction == Vector3.zero ? Vector3.right : direction;
|
|
||||||
SkillInputData.TargetCollider.transform.GetComponent<Rigidbody>().AddForce(direction * 70f, ForceMode.Impulse);
|
|
||||||
CoolDown(1f, () => IgnoreCollision(false));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
IgnoreCollision(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
HideIndicator();
|
HideIndicator();
|
||||||
|
|
||||||
var maxSize = Physics.OverlapSphereNonAlloc(transform.position, Range, hitColliders, SkillInputData.TargetLayer);
|
var maxSize = Physics.OverlapSphereNonAlloc(transform.position, Range, hitColliders, SkillInputData.TargetLayer);
|
||||||
@ -208,11 +192,24 @@ namespace RhinocerosSkill
|
|||||||
iDamageable?.TakeDamage(Damage);
|
iDamageable?.TakeDamage(Damage);
|
||||||
}
|
}
|
||||||
|
|
||||||
maxSize = Physics.OverlapSphereNonAlloc(transform.position, Range * 2f, hitColliders, SkillInputData.TargetLayer);
|
var stunRange = Range * 2f;
|
||||||
|
maxSize = Physics.OverlapSphereNonAlloc(transform.position, stunRange, hitColliders, SkillInputData.TargetLayer);
|
||||||
for (var i = 0; i < maxSize; i++)
|
for (var i = 0; i < maxSize; i++)
|
||||||
{
|
{
|
||||||
var iStun = hitColliders[i].GetComponent<IStun>();
|
var iCombatable = hitColliders[i].GetComponent<ICombatable>();
|
||||||
iStun?.Stun(stunTime);
|
if (iCombatable != null)
|
||||||
|
{
|
||||||
|
var targetToVector = hitColliders[i].transform.position - transform.position;
|
||||||
|
targetToVector.y = 0f;
|
||||||
|
var direction = targetToVector.normalized;
|
||||||
|
direction = direction == Vector3.zero ? Vector3.right : direction;
|
||||||
|
var distance = targetToVector.magnitude;
|
||||||
|
var powerCoefficient = stunRange - distance;
|
||||||
|
var addForcePower = powerCoefficient / stunRange * 10f;
|
||||||
|
|
||||||
|
iCombatable.Stun(stunTime);
|
||||||
|
iCombatable.AddForceToDirection(direction, addForcePower);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SkillInputData.PlayerAnimator.SetBool("isJump", false);
|
SkillInputData.PlayerAnimator.SetBool("isJump", false);
|
||||||
|
@ -126,6 +126,21 @@ namespace RhinocerosSkill
|
|||||||
var iDamageable = hits[i].transform.GetComponent<IDamageable>();
|
var iDamageable = hits[i].transform.GetComponent<IDamageable>();
|
||||||
iDamageable?.TakeDamage(Damage);
|
iDamageable?.TakeDamage(Damage);
|
||||||
isAttacked = true;
|
isAttacked = true;
|
||||||
|
|
||||||
|
var iCombatable = hits[i].transform.GetComponent<ICombatable>();
|
||||||
|
if (iCombatable != null)
|
||||||
|
{
|
||||||
|
var targetToVector = hits[i].transform.position - SkillInputData.PlayerRb.position;
|
||||||
|
targetToVector.y = 0f;
|
||||||
|
var hitDirection = targetToVector.normalized;
|
||||||
|
var dot = Vector3.Dot(hitDirection, direction);
|
||||||
|
var addForceDirection = dot >= 0f
|
||||||
|
? Quaternion.Euler(0, 90, 0) * direction
|
||||||
|
: Quaternion.Euler(0, -90, 0) * direction;
|
||||||
|
|
||||||
|
iCombatable.DisableMove(0.1f);
|
||||||
|
iCombatable.AddForceToDirection(addForceDirection, 15f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ namespace BlueWaterProject
|
|||||||
[SerializeField] private Slider slider;
|
[SerializeField] private Slider slider;
|
||||||
[SerializeField] private TMP_Text nameText;
|
[SerializeField] private TMP_Text nameText;
|
||||||
[SerializeField] private Slider damageEffectSlider;
|
[SerializeField] private Slider damageEffectSlider;
|
||||||
[SerializeField] private float damageEffectSpeed = 0.1f;
|
[SerializeField] private float duration = 1f;
|
||||||
|
|
||||||
[Button("셋팅 초기화")]
|
[Button("셋팅 초기화")]
|
||||||
private void Init()
|
private void Init()
|
||||||
@ -46,13 +46,18 @@ namespace BlueWaterProject
|
|||||||
|
|
||||||
private IEnumerator DamageEffect(float value)
|
private IEnumerator DamageEffect(float value)
|
||||||
{
|
{
|
||||||
|
var previousHp = slider.value;
|
||||||
|
var tick = (previousHp - value) / duration;
|
||||||
|
|
||||||
slider.value = value;
|
slider.value = value;
|
||||||
|
|
||||||
while (damageEffectSlider.value > value)
|
while (damageEffectSlider.value > value)
|
||||||
{
|
{
|
||||||
damageEffectSlider.value -= damageEffectSpeed;
|
damageEffectSlider.value -= tick * Time.deltaTime;
|
||||||
yield return null;
|
yield return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
damageEffectSlider.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetActiveHpSlider(bool value) => gameObject.SetActive(value);
|
public void SetActiveHpSlider(bool value) => gameObject.SetActive(value);
|
||||||
|
@ -119,9 +119,10 @@ namespace BlueWaterProject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (onHitAction == null)
|
if (onHitAction.GetPersistentEventCount() <= 0)
|
||||||
{
|
{
|
||||||
hit.transform.GetComponent<IDamageable>()?.TakeDamage(power);
|
var iDamageable = hit.transform.GetComponent<IDamageable>();
|
||||||
|
iDamageable?.TakeDamage(power);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -79,7 +79,7 @@ CapsuleCollider:
|
|||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_Bits: 0
|
m_Bits: 0
|
||||||
m_LayerOverridePriority: 0
|
m_LayerOverridePriority: 0
|
||||||
m_IsTrigger: 0
|
m_IsTrigger: 1
|
||||||
m_ProvidesContacts: 0
|
m_ProvidesContacts: 0
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
@ -262,7 +262,7 @@ SpriteRenderer:
|
|||||||
m_LightmapParameters: {fileID: 0}
|
m_LightmapParameters: {fileID: 0}
|
||||||
m_SortingLayerID: 0
|
m_SortingLayerID: 0
|
||||||
m_SortingLayer: 0
|
m_SortingLayer: 0
|
||||||
m_SortingOrder: 0
|
m_SortingOrder: 1
|
||||||
m_Sprite: {fileID: 1514449203, guid: 57b6cf5f2c06f364988909964c965ed1, type: 3}
|
m_Sprite: {fileID: 1514449203, guid: 57b6cf5f2c06f364988909964c965ed1, type: 3}
|
||||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||||
m_FlipX: 0
|
m_FlipX: 0
|
||||||
|
@ -3178,7 +3178,7 @@ CapsuleCollider:
|
|||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_Bits: 0
|
m_Bits: 0
|
||||||
m_LayerOverridePriority: 0
|
m_LayerOverridePriority: 0
|
||||||
m_IsTrigger: 0
|
m_IsTrigger: 1
|
||||||
m_ProvidesContacts: 0
|
m_ProvidesContacts: 0
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
|
@ -3372,7 +3372,7 @@ CapsuleCollider:
|
|||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_Bits: 0
|
m_Bits: 0
|
||||||
m_LayerOverridePriority: 0
|
m_LayerOverridePriority: 0
|
||||||
m_IsTrigger: 0
|
m_IsTrigger: 1
|
||||||
m_ProvidesContacts: 0
|
m_ProvidesContacts: 0
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
|
@ -55,7 +55,7 @@ SpriteRenderer:
|
|||||||
m_RenderingLayerMask: 1
|
m_RenderingLayerMask: 1
|
||||||
m_RendererPriority: 0
|
m_RendererPriority: 0
|
||||||
m_Materials:
|
m_Materials:
|
||||||
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
|
- {fileID: 2100000, guid: 8295418fd332b4a4a9a2a8aadededcad, type: 2}
|
||||||
m_StaticBatchInfo:
|
m_StaticBatchInfo:
|
||||||
firstSubMesh: 0
|
firstSubMesh: 0
|
||||||
subMeshCount: 0
|
subMeshCount: 0
|
||||||
@ -244,12 +244,14 @@ MonoBehaviour:
|
|||||||
<MyComponents>k__BackingField:
|
<MyComponents>k__BackingField:
|
||||||
playerInput: {fileID: 6121288256300454469}
|
playerInput: {fileID: 6121288256300454469}
|
||||||
visualLook: {fileID: 8557381169392297019}
|
visualLook: {fileID: 8557381169392297019}
|
||||||
|
spriteRenderer: {fileID: 1564585232883027199}
|
||||||
animator: {fileID: 3138574858532492034}
|
animator: {fileID: 3138574858532492034}
|
||||||
movement: {fileID: 803982772767150407}
|
movement: {fileID: 803982772767150407}
|
||||||
<MyCharacterOption>k__BackingField:
|
<MyCharacterOption>k__BackingField:
|
||||||
maxHp: 100
|
maxHp: 100
|
||||||
maxHitNum: 10
|
maxHitNum: 10
|
||||||
attackDamage: 10
|
firstAttackDamage: 10
|
||||||
|
secondAttackDamage: 15
|
||||||
attackTime: 0.7
|
attackTime: 0.7
|
||||||
attackRange: 1.5
|
attackRange: 1.5
|
||||||
attackAngle: 180
|
attackAngle: 180
|
||||||
@ -305,7 +307,7 @@ MonoBehaviour:
|
|||||||
groundCheckDistance: 1
|
groundCheckDistance: 1
|
||||||
groundCheckThreshold: 0.5
|
groundCheckThreshold: 0.5
|
||||||
<MyMovementOption>k__BackingField:
|
<MyMovementOption>k__BackingField:
|
||||||
moveSpeed: 10
|
moveSpeed: 7
|
||||||
maxSlopeAngle: 30
|
maxSlopeAngle: 30
|
||||||
dashSpeed: 20
|
dashSpeed: 20
|
||||||
dashTime: 0.2
|
dashTime: 0.2
|
||||||
|
@ -49,7 +49,7 @@ MonoBehaviour:
|
|||||||
<ReadySkill>k__BackingField: 1
|
<ReadySkill>k__BackingField: 1
|
||||||
<Damage>k__BackingField: 10
|
<Damage>k__BackingField: 10
|
||||||
<Cooldown>k__BackingField: 3
|
<Cooldown>k__BackingField: 3
|
||||||
<Range>k__BackingField: 7
|
<Range>k__BackingField: 3.5
|
||||||
<CastingTime>k__BackingField: 1
|
<CastingTime>k__BackingField: 1
|
||||||
<SkillDuration>k__BackingField: 0
|
<SkillDuration>k__BackingField: 0
|
||||||
isUsingIndicator: 1
|
isUsingIndicator: 1
|
||||||
|
Loading…
Reference in New Issue
Block a user