Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
commit
caeea0ffbf
File diff suppressed because it is too large
Load Diff
@ -1,314 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using Sirenix.OdinInspector;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
// ReSharper disable once CheckNamespace
|
||||
namespace BlueWaterProject
|
||||
{
|
||||
public class CombatPlayer : MonoBehaviour, IDamageable
|
||||
{
|
||||
[Title("초기화 방식")]
|
||||
[SerializeField] private bool autoInit = true;
|
||||
|
||||
[Title("캐릭터 변수")]
|
||||
[SerializeField] private float maxHp = 100f;
|
||||
[SerializeField] private float currentHp;
|
||||
[SerializeField] private float moveSpeed = 5f;
|
||||
[SerializeField] private float maxSlopeAngle = 50f;
|
||||
|
||||
[field: Title("대쉬")]
|
||||
[field: SerializeField] public float DashForce { get; set; } = 20f;
|
||||
[field: SerializeField] public float DashCooldown { get; set; } = 0.5f;
|
||||
[field: DisableIf("@true")]
|
||||
[field: SerializeField] public bool IsDashing { get; set; }
|
||||
[field: DisableIf("@true")]
|
||||
[field: SerializeField] public bool EnableDash { get; set; } = true;
|
||||
|
||||
[field: Title("공격")]
|
||||
[field: SerializeField] public int MaxHitNum { get; set; } = 10;
|
||||
[field: SerializeField] public float AttackDamage { get; set; } = 10f;
|
||||
[field: SerializeField] public float AttackRange { get; set; } = 1.5f;
|
||||
[field: SerializeField] public float AttackAngle { get; set; } = 180f;
|
||||
[field: SerializeField] public float ComboTime { get; set; } = 0.5f;
|
||||
[field: SerializeField] public LayerMask TargetLayer { get; set; }
|
||||
[field: DisableIf("@true")]
|
||||
[field: SerializeField] public bool IsAttacking { get; set; }
|
||||
[field: DisableIf("@true")]
|
||||
[field: SerializeField] public bool IsComboAttacking { get; set; }
|
||||
[field: DisableIf("@true")]
|
||||
[field: SerializeField] public bool IsComboPossible { get; set; }
|
||||
|
||||
[Title("컴포넌트")]
|
||||
[SerializeField] private PlayerInput playerInput;
|
||||
[field: SerializeField] public Rigidbody Rb { get; set; }
|
||||
[SerializeField] private Transform visualLook;
|
||||
[field: SerializeField] public Animator Animator { get; set; }
|
||||
[SerializeField] private Transform groundCheck;
|
||||
|
||||
private Vector2 movementInput;
|
||||
public Vector3 PreviousDirection { get; set; } = Vector3.back;
|
||||
[field: SerializeField] public Collider[] HitColliders { get; set; }
|
||||
private RaycastHit slopeHit;
|
||||
private int groundLayer;
|
||||
|
||||
private const float RAY_DISTANCE = 3f;
|
||||
|
||||
private static readonly int XDirectionHash = Animator.StringToHash("xDirection");
|
||||
private static readonly int ZDirectionHash = Animator.StringToHash("zDirection");
|
||||
private static readonly int IsMovingHash = Animator.StringToHash("isMoving");
|
||||
public readonly int isDashingHash = Animator.StringToHash("isDashing");
|
||||
public readonly int isAttackingHash = Animator.StringToHash("isAttacking");
|
||||
|
||||
private void OnDrawGizmosSelected()
|
||||
{
|
||||
var lossyScale = transform.lossyScale;
|
||||
var boxSize = new Vector3(lossyScale.x, 0.4f, lossyScale.z * 0.5f);
|
||||
Gizmos.color = IsGrounded() ? Color.blue : Color.red;
|
||||
Gizmos.DrawWireCube(groundCheck.position, boxSize);
|
||||
}
|
||||
|
||||
[Button("셋팅 초기화")]
|
||||
private void Init()
|
||||
{
|
||||
playerInput = GetComponent<PlayerInput>();
|
||||
Rb = GetComponent<Rigidbody>();
|
||||
visualLook = transform.Find("VisualLook");
|
||||
Animator = visualLook.GetComponent<Animator>();
|
||||
groundCheck = transform.Find("GroundCheck");
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (autoInit)
|
||||
{
|
||||
Init();
|
||||
}
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
HitColliders = new Collider[MaxHitNum];
|
||||
groundLayer = 1 << LayerMask.NameToLayer("Ground");
|
||||
|
||||
SetCurrentHp(maxHp);
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
playerInput.actions.FindAction("Attack").performed += OnAttackEvent;
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
playerInput.actions.FindAction("Attack").performed -= OnAttackEvent;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
var isMoving = Rb.velocity.magnitude > 0.1f;
|
||||
if (isMoving)
|
||||
{
|
||||
PreviousDirection = Rb.velocity.normalized;
|
||||
Animator.SetFloat(XDirectionHash, PreviousDirection.x);
|
||||
Animator.SetFloat(ZDirectionHash, PreviousDirection.z);
|
||||
}
|
||||
Animator.SetBool(IsMovingHash, isMoving);
|
||||
|
||||
var localScale = visualLook.localScale;
|
||||
localScale.x = Rb.velocity.x switch
|
||||
{
|
||||
> 0.01f => Mathf.Abs(localScale.x),
|
||||
< -0.01f => -Mathf.Abs(localScale.x),
|
||||
_ => localScale.x
|
||||
};
|
||||
visualLook.localScale = localScale;
|
||||
}
|
||||
|
||||
private void FixedUpdate()
|
||||
{
|
||||
HandleMovement();
|
||||
}
|
||||
|
||||
public void TakeDamage(float attackerPower, Vector3? attackPos = null)
|
||||
{
|
||||
if (IsDashing) return;
|
||||
|
||||
var changeHp = Mathf.Max(currentHp - attackerPower, 0);
|
||||
SetCurrentHp(changeHp);
|
||||
|
||||
if (InIslandCamera.Inst.InIslandCam)
|
||||
{
|
||||
VisualFeedbackManager.Inst.CameraShake(InIslandCamera.Inst.InIslandCam);
|
||||
}
|
||||
|
||||
// 죽었는지 체크
|
||||
if (changeHp == 0f)
|
||||
{
|
||||
Die();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public void Die()
|
||||
{
|
||||
print("Combat Player Die");
|
||||
}
|
||||
|
||||
private void OnMove(InputValue value)
|
||||
{
|
||||
movementInput = value.Get<Vector2>();
|
||||
}
|
||||
|
||||
public void OnDash()
|
||||
{
|
||||
if (!EnableDash || IsDashing) return;
|
||||
|
||||
Animator.SetBool(isDashingHash, true);
|
||||
}
|
||||
|
||||
private void OnAttackEvent(InputAction.CallbackContext context)
|
||||
{
|
||||
if (IsAttacking && !IsComboPossible) return;
|
||||
|
||||
// var control = context.control;
|
||||
//
|
||||
// if (control.name.Equals("leftButton"))
|
||||
// {
|
||||
// UseMouseAttack = true;
|
||||
// }
|
||||
// else if (control.name.Equals("k"))
|
||||
// {
|
||||
// UseMouseAttack = false;
|
||||
// }
|
||||
|
||||
if (IsComboPossible)
|
||||
{
|
||||
IsComboAttacking = true;
|
||||
return;
|
||||
}
|
||||
Animator.SetBool(isAttackingHash, true);
|
||||
}
|
||||
|
||||
private void HandleMovement()
|
||||
{
|
||||
var movement = new Vector3(movementInput.x, 0, movementInput.y);
|
||||
var moveDirection = IsDashing ? PreviousDirection : movement.normalized;
|
||||
|
||||
var velocity = CalculateNextFrameGroundAngle(moveDirection) < maxSlopeAngle ? moveDirection : Vector3.zero;
|
||||
var gravity = Vector3.down * Mathf.Abs(Rb.velocity.y);
|
||||
|
||||
if (IsOnSlope() || velocity == moveDirection && IsGrounded())
|
||||
{
|
||||
velocity = Vector3.ProjectOnPlane(moveDirection, slopeHit.normal).normalized;
|
||||
gravity = Vector3.zero;
|
||||
Rb.useGravity = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Rb.useGravity = true;
|
||||
}
|
||||
|
||||
var moveValue = IsDashing ? DashForce : moveSpeed;
|
||||
Rb.velocity = velocity * moveValue + gravity;
|
||||
}
|
||||
|
||||
public bool IsOnSlope()
|
||||
{
|
||||
var ray = new Ray(transform.position, Vector3.down);
|
||||
|
||||
if (Physics.Raycast(ray, out slopeHit, RAY_DISTANCE, groundLayer))
|
||||
{
|
||||
var angle = Vector3.Angle(Vector3.up, slopeHit.normal);
|
||||
Debug.DrawRay(transform.position, Vector3.down, angle != 0f && angle < maxSlopeAngle ? Color.blue : Color.red);
|
||||
return angle != 0f && angle < maxSlopeAngle;
|
||||
}
|
||||
Debug.DrawRay(transform.position, Vector3.down, Color.red);
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool IsGrounded()
|
||||
{
|
||||
var lossyScale = transform.lossyScale;
|
||||
var boxSize = new Vector3(lossyScale.x, 0.4f, lossyScale.z * 0.5f);
|
||||
return Physics.CheckBox(groundCheck.position, boxSize, Quaternion.identity, groundLayer);
|
||||
}
|
||||
|
||||
private float CalculateNextFrameGroundAngle(Vector3 direction)
|
||||
{
|
||||
var nextFramePlayerPosition = transform.position + direction * (3f * moveSpeed * Time.fixedDeltaTime);
|
||||
|
||||
if (Physics.Raycast(nextFramePlayerPosition, Vector3.down, out var hitInfo, RAY_DISTANCE, groundLayer))
|
||||
{
|
||||
if (Vector3.Angle(Vector3.up, hitInfo.normal) > maxSlopeAngle)
|
||||
{
|
||||
Debug.DrawRay(hitInfo.point, hitInfo.normal, Color.red);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.DrawRay(hitInfo.point, hitInfo.normal, Color.cyan);
|
||||
}
|
||||
Debug.DrawRay(nextFramePlayerPosition, Vector3.down, Color.green);
|
||||
return Vector3.Angle(Vector3.up, hitInfo.normal);
|
||||
}
|
||||
Debug.DrawRay(nextFramePlayerPosition, Vector3.down, Color.magenta);
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void AttackTiming()
|
||||
{
|
||||
var attackDirection = PreviousDirection;
|
||||
|
||||
Array.Clear(HitColliders, 0, MaxHitNum);
|
||||
|
||||
var size = Physics.OverlapSphereNonAlloc(transform.position, AttackRange, HitColliders, TargetLayer);
|
||||
|
||||
for (var i = 0; i < size; i++)
|
||||
{
|
||||
var targetDirection = (HitColliders[i].transform.position - transform.position).normalized;
|
||||
var angleBetween = Vector3.Angle(attackDirection, targetDirection);
|
||||
|
||||
if (angleBetween >= AttackAngle * 0.5f) continue;
|
||||
|
||||
if (HitColliders[i].gameObject.layer == LayerMask.NameToLayer("Enemy"))
|
||||
{
|
||||
var iDamageable = HitColliders[i].transform.GetComponent<IDamageable>();
|
||||
iDamageable.TakeDamage(AttackDamage);
|
||||
VisualFeedbackManager.Inst.TriggerHitStop(0.1f);
|
||||
}
|
||||
else if (HitColliders[i].gameObject.layer == LayerMask.NameToLayer("Skill") &&
|
||||
HitColliders[i].CompareTag("DestructiveSkill"))
|
||||
{
|
||||
var iDamageable = HitColliders[i].transform.GetComponent<IDamageable>();
|
||||
iDamageable.TakeDamage(AttackDamage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void CoolDown(float waitTime, Action onCooldownComplete = null)
|
||||
{
|
||||
StartCoroutine(CoolDownCoroutine(waitTime, onCooldownComplete));
|
||||
}
|
||||
|
||||
private IEnumerator CoolDownCoroutine(float waitTime, Action onCooldownComplete = null)
|
||||
{
|
||||
var time = 0f;
|
||||
|
||||
while (time <= waitTime)
|
||||
{
|
||||
time += Time.deltaTime;
|
||||
yield return null;
|
||||
}
|
||||
|
||||
onCooldownComplete?.Invoke();
|
||||
}
|
||||
|
||||
private void SetCurrentHp(float value)
|
||||
{
|
||||
currentHp = value;
|
||||
}
|
||||
|
||||
public RaycastHit GetSlopeHit() => slopeHit;
|
||||
}
|
||||
}
|
@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5258cddac7934c1469d147dddbdb5023
|
@ -5,23 +5,27 @@ namespace BlueWaterProject
|
||||
{
|
||||
public class CombatPlayerAnimationEventController : MonoBehaviour
|
||||
{
|
||||
private CombatPlayer combatPlayer;
|
||||
private CombatPlayerController combatPlayerController;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
combatPlayer = GetComponentInParent<CombatPlayer>();
|
||||
combatPlayerController = GetComponentInParent<CombatPlayerController>();
|
||||
if (!combatPlayerController)
|
||||
{
|
||||
print("애니메이션 이벤트 컨트롤러가 없습니다.");
|
||||
}
|
||||
}
|
||||
|
||||
public void CheckComboAttack()
|
||||
{
|
||||
if (combatPlayer.IsComboAttacking) return;
|
||||
if (combatPlayerController.GetIsComboAttacking()) return;
|
||||
|
||||
combatPlayer.Animator.SetBool(combatPlayer.isAttackingHash, false);
|
||||
combatPlayerController.MyComponents.animator.SetBool(CombatPlayerController.IsAttackingHash, false);
|
||||
}
|
||||
|
||||
public void AttackTiming()
|
||||
{
|
||||
combatPlayer.AttackTiming();
|
||||
combatPlayerController.AttackTiming();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,298 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using Sirenix.OdinInspector;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
// ReSharper disable once CheckNamespace
|
||||
namespace BlueWaterProject
|
||||
{
|
||||
public class CombatPlayerController : MonoBehaviour, IDamageable
|
||||
{
|
||||
/***********************************************************************
|
||||
* Definitions
|
||||
***********************************************************************/
|
||||
#region Class
|
||||
|
||||
[Serializable]
|
||||
public class Components
|
||||
{
|
||||
public PlayerInput playerInput;
|
||||
public Transform visualLook;
|
||||
public Animator animator;
|
||||
public PhysicsMovement movement;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class CharacterOption
|
||||
{
|
||||
[Range(0f, 1000f), Tooltip("최대 체력")]
|
||||
public float maxHp = 100f;
|
||||
|
||||
[Title("공격")]
|
||||
[Range(1, 21), Tooltip("한 번에 공격 가능한 개체 수")]
|
||||
public int maxHitNum = 10;
|
||||
|
||||
[Range(0f, 100f), Tooltip("공격 데미지")]
|
||||
public float attackDamage = 10f;
|
||||
|
||||
[Range(0.1f, 2f), Tooltip("콤보 공격 포함 총 걸리는 시간")]
|
||||
public float attackTime = 0.7f;
|
||||
|
||||
[Range(0.1f, 5f), Tooltip("공격 범위 사거리(반지름)")]
|
||||
public float attackRange = 1.5f;
|
||||
|
||||
[Range(0f, 360f), Tooltip("공격 범위 각도")]
|
||||
public float attackAngle = 180f;
|
||||
|
||||
[Tooltip("공격할 레이어 설정")]
|
||||
public LayerMask targetLayer = -1;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
[DisableIf("@true")]
|
||||
public class CurrentState
|
||||
{
|
||||
public bool isAttacking;
|
||||
public bool isComboPossible;
|
||||
public bool isComboAttacking;
|
||||
}
|
||||
|
||||
[DisableIf("@true")]
|
||||
[Serializable]
|
||||
public class CurrentValue
|
||||
{
|
||||
[Tooltip("현재 체력")]
|
||||
public float currentHp;
|
||||
|
||||
[Tooltip("최근에 공격 받은 충돌체 배열")]
|
||||
public Collider[] hitColliders;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/***********************************************************************
|
||||
* Variables
|
||||
***********************************************************************/
|
||||
#region Variables
|
||||
|
||||
[field: SerializeField] public Components MyComponents { get; private set; }
|
||||
[field: SerializeField] public CharacterOption MyCharacterOption { get; private set; }
|
||||
[field: SerializeField] public CurrentState MyCurrentState { get; set; }
|
||||
[field: SerializeField] public CurrentValue MyCurrentValue { get; set; }
|
||||
|
||||
public static readonly int IsMovingHash = Animator.StringToHash("isMoving");
|
||||
public static readonly int XDirectionHash = Animator.StringToHash("xDirection");
|
||||
public static readonly int ZDirectionHash = Animator.StringToHash("zDirection");
|
||||
public static readonly int IsAttackingHash = Animator.StringToHash("isAttacking");
|
||||
|
||||
#endregion
|
||||
|
||||
/***********************************************************************
|
||||
* Unity Events
|
||||
***********************************************************************/
|
||||
#region Unity Events
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
MyComponents.playerInput.actions.FindAction("Attack").performed += OnAttackEvent;
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
MyComponents.playerInput.actions.FindAction("Attack").performed -= OnAttackEvent;
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
InitComponents();
|
||||
InitStartValue();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
MoveAnimation();
|
||||
FlipVisualLook(MyComponents.movement.GetPreviousMoveDirection().x);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/***********************************************************************
|
||||
* Init Methods
|
||||
***********************************************************************/
|
||||
#region Unity Events
|
||||
|
||||
private void InitComponents()
|
||||
{
|
||||
if (!TryGetComponent(out MyComponents.movement))
|
||||
{
|
||||
MyComponents.movement = gameObject.AddComponent<PhysicsMovement>();
|
||||
}
|
||||
|
||||
MyComponents.movement.SetAnimator(MyComponents.animator);
|
||||
}
|
||||
|
||||
private void InitStartValue()
|
||||
{
|
||||
MyCurrentValue.hitColliders = new Collider[MyCharacterOption.maxHitNum];
|
||||
SetCurrentHp(MyCharacterOption.maxHp);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/***********************************************************************
|
||||
* Player Input
|
||||
***********************************************************************/
|
||||
#region Unity Events
|
||||
|
||||
private void OnAttackEvent(InputAction.CallbackContext context)
|
||||
{
|
||||
if (MyCurrentState.isAttacking && !MyCurrentState.isComboPossible) return;
|
||||
|
||||
// var control = context.control;
|
||||
//
|
||||
// if (control.name.Equals("leftButton"))
|
||||
// {
|
||||
// UseMouseAttack = true;
|
||||
// }
|
||||
// else if (control.name.Equals("k"))
|
||||
// {
|
||||
// UseMouseAttack = false;
|
||||
// }
|
||||
|
||||
if (MyCurrentState.isComboPossible)
|
||||
{
|
||||
MyCurrentState.isComboAttacking = true;
|
||||
return;
|
||||
}
|
||||
MyComponents.animator.SetBool(IsAttackingHash, true);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/***********************************************************************
|
||||
* Interfaces
|
||||
***********************************************************************/
|
||||
#region Interfaces
|
||||
|
||||
// IDamageable
|
||||
public void TakeDamage(float attackerPower, Vector3? attackPos = null)
|
||||
{
|
||||
if (MyComponents.movement.GetIsDashing()) return;
|
||||
|
||||
var changeHp = Mathf.Max(MyCurrentValue.currentHp - attackerPower, 0);
|
||||
SetCurrentHp(changeHp);
|
||||
|
||||
if (InIslandCamera.Inst.InIslandCam)
|
||||
{
|
||||
VisualFeedbackManager.Inst.CameraShake(InIslandCamera.Inst.InIslandCam);
|
||||
}
|
||||
|
||||
// 죽었는지 체크
|
||||
if (changeHp == 0f)
|
||||
{
|
||||
Die();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public void Die()
|
||||
{
|
||||
print("Combat Player Die");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/***********************************************************************
|
||||
* Methods
|
||||
***********************************************************************/
|
||||
#region Methods
|
||||
|
||||
public void AttackTiming()
|
||||
{
|
||||
var attackDirection = MyComponents.movement.GetPreviousMoveDirection();
|
||||
|
||||
Array.Clear(MyCurrentValue.hitColliders, 0, MyCharacterOption.maxHitNum);
|
||||
|
||||
var size = Physics.OverlapSphereNonAlloc(transform.position, MyCharacterOption.attackRange, MyCurrentValue.hitColliders, MyCharacterOption.targetLayer);
|
||||
|
||||
for (var i = 0; i < size; i++)
|
||||
{
|
||||
var targetDirection = (MyCurrentValue.hitColliders[i].transform.position - transform.position).normalized;
|
||||
var angleBetween = Vector3.Angle(attackDirection, targetDirection);
|
||||
|
||||
if (angleBetween >= MyCharacterOption.attackAngle * 0.5f) continue;
|
||||
|
||||
if (MyCurrentValue.hitColliders[i].gameObject.layer == LayerMask.NameToLayer("Enemy"))
|
||||
{
|
||||
var iDamageable = MyCurrentValue.hitColliders[i].transform.GetComponent<IDamageable>();
|
||||
iDamageable.TakeDamage(MyCharacterOption.attackDamage);
|
||||
VisualFeedbackManager.Inst.TriggerHitStop(0.1f);
|
||||
}
|
||||
else if (MyCurrentValue.hitColliders[i].gameObject.layer == LayerMask.NameToLayer("Skill") &&
|
||||
MyCurrentValue.hitColliders[i].CompareTag("DestructiveSkill"))
|
||||
{
|
||||
var iDamageable = MyCurrentValue.hitColliders[i].transform.GetComponent<IDamageable>();
|
||||
iDamageable.TakeDamage(MyCharacterOption.attackDamage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void MoveAnimation()
|
||||
{
|
||||
var isMoving = MyComponents.movement.GetIsMoving();
|
||||
var previousDirection = MyComponents.movement.GetPreviousMoveDirection();
|
||||
MyComponents.animator.SetBool(IsMovingHash, isMoving);
|
||||
if (isMoving)
|
||||
{
|
||||
MyComponents.animator.SetFloat(XDirectionHash, previousDirection.x);
|
||||
MyComponents.animator.SetFloat(ZDirectionHash, previousDirection.z);
|
||||
}
|
||||
}
|
||||
|
||||
private void FlipVisualLook(float previousDirectionX)
|
||||
{
|
||||
var localScale = MyComponents.visualLook.localScale;
|
||||
localScale.x = previousDirectionX switch
|
||||
{
|
||||
> 0.01f => Mathf.Abs(localScale.x),
|
||||
< -0.01f => -Mathf.Abs(localScale.x),
|
||||
_ => localScale.x
|
||||
};
|
||||
MyComponents.visualLook.localScale = localScale;
|
||||
}
|
||||
|
||||
public void CoolDown(float waitTime, Action onCooldownComplete = null)
|
||||
{
|
||||
StartCoroutine(CoolDownCoroutine(waitTime, onCooldownComplete));
|
||||
}
|
||||
|
||||
private IEnumerator CoolDownCoroutine(float waitTime, Action onCooldownComplete = null)
|
||||
{
|
||||
var time = 0f;
|
||||
|
||||
while (time <= waitTime)
|
||||
{
|
||||
time += Time.deltaTime;
|
||||
yield return null;
|
||||
}
|
||||
|
||||
onCooldownComplete?.Invoke();
|
||||
}
|
||||
|
||||
[Button("현재 체력 변경")]
|
||||
private void SetCurrentHp(float value) => MyCurrentValue.currentHp = value;
|
||||
public bool GetIsAttacking() => MyCurrentState.isAttacking;
|
||||
public bool GetIsComboAttacking() => MyCurrentState.isComboAttacking;
|
||||
public float GetDashCooldown() => MyComponents.movement.GetDashCooldown();
|
||||
public float GetDashTime() => MyComponents.movement.GetDashTime();
|
||||
public float GetAttackTime() => MyCharacterOption.attackTime;
|
||||
public void SetIsAttacking(bool value) => MyCurrentState.isAttacking = value;
|
||||
public void SetIsComboAttacking(bool value) => MyCurrentState.isComboAttacking = value;
|
||||
public void SetIsComboPossible(bool value) => MyCurrentState.isComboPossible = value;
|
||||
public void SetIsDashing(bool value) => MyComponents.movement.SetIsDashing(value);
|
||||
public void SetEnableDashing(bool value) => MyComponents.movement.SetEnableDashing(value);
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d85ab5237d86f7a43a553f00be353476
|
@ -0,0 +1,486 @@
|
||||
using System;
|
||||
using Sirenix.OdinInspector;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
using UnityEngine.Serialization;
|
||||
|
||||
// ReSharper disable once CheckNamespace
|
||||
namespace BlueWaterProject
|
||||
{
|
||||
public class PhysicsMovement : MonoBehaviour
|
||||
{
|
||||
/***********************************************************************
|
||||
* Definitions
|
||||
***********************************************************************/
|
||||
|
||||
#region Class
|
||||
|
||||
[Serializable]
|
||||
public class Components
|
||||
{
|
||||
public CapsuleCollider capsuleCollider;
|
||||
public Rigidbody rb;
|
||||
[ShowIf("@false")]
|
||||
public Animator animator;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class CheckOption
|
||||
{
|
||||
[Tooltip("지면으로 체크할 레이어 설정")]
|
||||
public LayerMask groundLayer = -1;
|
||||
|
||||
[Range(0.01f, 0.5f), Tooltip("전방 감지 거리")]
|
||||
public float forwardCheckDistance = 0.1f;
|
||||
|
||||
[Range(0.1f, 10.0f), Tooltip("지면 감지 거리")]
|
||||
public float groundCheckDistance = 2.0f;
|
||||
|
||||
[Range(0.0f, 0.5f), Tooltip("지면 인식 허용 거리")]
|
||||
public float groundCheckThreshold = 0.01f;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class MovementOption
|
||||
{
|
||||
[Range(1f, 10f), Tooltip("이동 속도")]
|
||||
public float moveSpeed = 10f;
|
||||
|
||||
[Range(1f, 75f), Tooltip("등반 가능한 경사각")]
|
||||
public float maxSlopeAngle = 50f;
|
||||
|
||||
[Range(1f, 50f), Tooltip("대쉬 속도")]
|
||||
public float dashSpeed = 30f;
|
||||
|
||||
[Range(0.1f, 1f), Tooltip("대쉬 시간")]
|
||||
public float dashTime = 0.2f;
|
||||
|
||||
[Range(0f, 5f), Tooltip("대쉬 쿨타임")]
|
||||
public float dashCooldown = 0.5f;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
[DisableIf("@true")]
|
||||
public class CurrentState
|
||||
{
|
||||
public bool isMoving;
|
||||
public bool isGrounded;
|
||||
public bool isOnSlope;
|
||||
public bool isOnSteepSlope;
|
||||
public bool isForwardBlocked;
|
||||
public bool isOutOfControl;
|
||||
public bool isDashing;
|
||||
public bool enableDash = true;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
[DisableIf("@true")]
|
||||
public class CurrentValue
|
||||
{
|
||||
public Vector2 movementInput;
|
||||
public Vector3 currentMoveDirection;
|
||||
public Vector3 previousMoveDirection = Vector3.back;
|
||||
public Vector3 groundNormal;
|
||||
public Vector3 groundCross;
|
||||
public Vector3 horizontalVelocity;
|
||||
|
||||
[Space]
|
||||
public float outOfControlDuration;
|
||||
|
||||
[Space]
|
||||
public float groundDistance;
|
||||
public float groundSlopeAngle; // 현재 바닥의 경사각
|
||||
public float forwardSlopeAngle; // 캐릭터가 바라보는 방향의 경사각
|
||||
|
||||
[Space]
|
||||
public Vector3 gravity;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/***********************************************************************
|
||||
* Variables
|
||||
***********************************************************************/
|
||||
#region Variables
|
||||
|
||||
[field: SerializeField] public Components MyComponents { get; private set; } = new();
|
||||
[field: SerializeField] public CheckOption MyCheckOption { get; private set; } = new();
|
||||
[field: SerializeField] public MovementOption MyMovementOption { get; private set; } = new();
|
||||
[field: SerializeField] public CurrentState MyCurrentState { get; set; } = new();
|
||||
[field: SerializeField] public CurrentValue MyCurrentValue { get; set; } = new();
|
||||
|
||||
private float capsuleRadiusDifferent;
|
||||
private float castRadius;
|
||||
|
||||
private Vector3 CapsuleTopCenterPoint => new(transform.position.x,
|
||||
transform.position.y + MyComponents.capsuleCollider.height - MyComponents.capsuleCollider.radius,
|
||||
transform.position.z);
|
||||
|
||||
private Vector3 CapsuleBottomCenterPoint => new(transform.position.x,
|
||||
transform.position.y + MyComponents.capsuleCollider.radius,
|
||||
transform.position.z);
|
||||
|
||||
public static readonly int IsDashingHash = Animator.StringToHash("isDashing");
|
||||
|
||||
#endregion
|
||||
|
||||
/***********************************************************************
|
||||
* Unity Events
|
||||
***********************************************************************/
|
||||
#region Unity Events
|
||||
|
||||
private void Start()
|
||||
{
|
||||
InitRigidbody();
|
||||
InitCapsuleCollider();
|
||||
InitStartValue();
|
||||
}
|
||||
|
||||
private void FixedUpdate()
|
||||
{
|
||||
InputMove();
|
||||
CheckGround();
|
||||
CheckForward();
|
||||
|
||||
UpdateValues();
|
||||
|
||||
CalculateMovements();
|
||||
ApplyMovementsToRigidbody();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/***********************************************************************
|
||||
* Init Methods
|
||||
***********************************************************************/
|
||||
|
||||
#region Init Methods
|
||||
|
||||
private void InitRigidbody()
|
||||
{
|
||||
if (TryGetComponent(out MyComponents.rb)) return;
|
||||
|
||||
MyComponents.rb = gameObject.AddComponent<Rigidbody>();
|
||||
|
||||
MyComponents.rb.constraints = RigidbodyConstraints.FreezeRotation;
|
||||
MyComponents.rb.interpolation = RigidbodyInterpolation.Interpolate;
|
||||
MyComponents.rb.collisionDetectionMode = CollisionDetectionMode.ContinuousDynamic;
|
||||
MyComponents.rb.useGravity = true;
|
||||
}
|
||||
|
||||
private void InitCapsuleCollider()
|
||||
{
|
||||
if (!TryGetComponent(out MyComponents.capsuleCollider))
|
||||
{
|
||||
MyComponents.capsuleCollider = gameObject.AddComponent<CapsuleCollider>();
|
||||
|
||||
MyComponents.capsuleCollider.height = 2f;
|
||||
MyComponents.capsuleCollider.center = Vector3.up;
|
||||
MyComponents.capsuleCollider.radius = 0.5f;
|
||||
}
|
||||
|
||||
var capsuleColliderRadius = MyComponents.capsuleCollider.radius;
|
||||
castRadius = capsuleColliderRadius * 0.9f;
|
||||
capsuleRadiusDifferent = capsuleColliderRadius - castRadius + 0.05f;
|
||||
}
|
||||
|
||||
private void InitStartValue()
|
||||
{
|
||||
MyCurrentValue.gravity = Physics.gravity;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/***********************************************************************
|
||||
* PlayerInput
|
||||
***********************************************************************/
|
||||
|
||||
#region PlayerInput
|
||||
|
||||
private void OnMove(InputValue value)
|
||||
{
|
||||
MyCurrentValue.movementInput = value.Get<Vector2>();
|
||||
}
|
||||
|
||||
private void OnDash()
|
||||
{
|
||||
if (!MyCurrentState.enableDash || MyCurrentState.isDashing) return;
|
||||
|
||||
MyComponents.animator.SetBool(IsDashingHash, true);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/***********************************************************************
|
||||
* Methods
|
||||
***********************************************************************/
|
||||
#region Methods
|
||||
|
||||
private void InputMove()
|
||||
{
|
||||
if (MyCurrentValue.currentMoveDirection != Vector3.zero)
|
||||
{
|
||||
MyCurrentValue.previousMoveDirection = MyCurrentValue.currentMoveDirection;
|
||||
}
|
||||
MyCurrentValue.currentMoveDirection = MyCurrentState.isDashing
|
||||
? MyCurrentValue.previousMoveDirection
|
||||
: new Vector3(MyCurrentValue.movementInput.x, 0,MyCurrentValue.movementInput.y).normalized;
|
||||
MyCurrentState.isMoving = MyCurrentValue.currentMoveDirection != Vector3.zero;
|
||||
}
|
||||
|
||||
/// <summary> 하단 지면 검사 </summary>
|
||||
private void CheckGround()
|
||||
{
|
||||
MyCurrentValue.groundDistance = float.MaxValue;
|
||||
MyCurrentValue.groundNormal = Vector3.up;
|
||||
MyCurrentValue.groundSlopeAngle = 0f;
|
||||
MyCurrentValue.forwardSlopeAngle = 0f;
|
||||
|
||||
var groundRaycast = Physics.SphereCast(CapsuleBottomCenterPoint, castRadius,Vector3.down,
|
||||
out var hit, MyCheckOption.groundCheckDistance, MyCheckOption.groundLayer, QueryTriggerInteraction.Ignore);
|
||||
|
||||
MyCurrentState.isGrounded = false;
|
||||
|
||||
if (groundRaycast)
|
||||
{
|
||||
MyCurrentValue.groundNormal = hit.normal;
|
||||
MyCurrentValue.groundSlopeAngle = Vector3.Angle(MyCurrentValue.groundNormal, Vector3.up);
|
||||
MyCurrentValue.forwardSlopeAngle = Vector3.Angle(MyCurrentValue.groundNormal, MyCurrentValue.currentMoveDirection) - 90f;
|
||||
MyCurrentState.isOnSlope = MyCurrentValue.groundSlopeAngle > 0f && MyCurrentValue.groundSlopeAngle < MyMovementOption.maxSlopeAngle;
|
||||
MyCurrentState.isOnSteepSlope = MyCurrentValue.groundSlopeAngle >= MyMovementOption.maxSlopeAngle;
|
||||
|
||||
// 경사각 이중검증 (수직 레이캐스트) : 뾰족하거나 각진 부분 체크
|
||||
//if (State.isOnSteepSlope)
|
||||
//{
|
||||
// Vector3 ro = hit.point + Vector3.up * 0.1f;
|
||||
// Vector3 rd = Vector3.down;
|
||||
// bool rayD =
|
||||
// Physics.SphereCast(ro, 0.09f, rd, out var hitRayD, 0.2f, COption.groundLayerMask, QueryTriggerInteraction.Ignore);
|
||||
|
||||
// Current.groundVerticalSlopeAngle = rayD ? Vector3.Angle(hitRayD.normal, Vector3.up) : Current.groundSlopeAngle;
|
||||
|
||||
// State.isOnSteepSlope = Current.groundVerticalSlopeAngle >= MOption.maxSlopeAngle;
|
||||
//}
|
||||
|
||||
MyCurrentValue.groundDistance = Mathf.Max(hit.distance - capsuleRadiusDifferent - MyCheckOption.groundCheckThreshold, 0f);
|
||||
MyCurrentState.isGrounded = (MyCurrentValue.groundDistance <= 0.0001f) && !MyCurrentState.isOnSteepSlope;
|
||||
|
||||
GizmosUpdateValue(ref gzGroundTouch, hit.point);
|
||||
}
|
||||
|
||||
MyCurrentValue.groundCross = Vector3.Cross(MyCurrentValue.groundNormal, Vector3.up);
|
||||
}
|
||||
|
||||
/// <summary> 전방 장애물 검사 : 레이어 관계 없이 trigger가 아닌 모든 장애물 검사 </summary>
|
||||
private void CheckForward()
|
||||
{
|
||||
var obstacleRaycast = Physics.CapsuleCast(CapsuleBottomCenterPoint, CapsuleTopCenterPoint, castRadius,
|
||||
MyCurrentValue.currentMoveDirection + Vector3.down * 0.1f,
|
||||
out var hit, MyCheckOption.forwardCheckDistance, -1, QueryTriggerInteraction.Ignore);
|
||||
|
||||
MyCurrentState.isForwardBlocked = false;
|
||||
if (obstacleRaycast)
|
||||
{
|
||||
var forwardObstacleAngle = Vector3.Angle(hit.normal, Vector3.up);
|
||||
MyCurrentState.isForwardBlocked = forwardObstacleAngle >= MyMovementOption.maxSlopeAngle;
|
||||
|
||||
GizmosUpdateValue(ref gzForwardTouch, hit.point);
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateValues()
|
||||
{
|
||||
MyCurrentState.isOutOfControl = MyCurrentValue.outOfControlDuration > 0f;
|
||||
|
||||
if (MyCurrentState.isOutOfControl)
|
||||
{
|
||||
MyCurrentValue.outOfControlDuration -= Time.fixedDeltaTime;
|
||||
MyCurrentValue.currentMoveDirection = Vector3.zero;
|
||||
}
|
||||
}
|
||||
|
||||
private void CalculateMovements()
|
||||
{
|
||||
if (MyCurrentState.isOutOfControl)
|
||||
{
|
||||
MyComponents.rb.useGravity = true;
|
||||
MyCurrentValue.horizontalVelocity = Vector3.zero;
|
||||
return;
|
||||
}
|
||||
|
||||
var speed = 0f;
|
||||
if (MyCurrentState.isDashing)
|
||||
{
|
||||
speed = MyMovementOption.dashSpeed;
|
||||
}
|
||||
else
|
||||
{
|
||||
speed = MyCurrentState.isMoving ? MyMovementOption.moveSpeed : 0f;
|
||||
}
|
||||
|
||||
if (MyCurrentState.isOnSlope)
|
||||
{
|
||||
MyComponents.rb.useGravity = false;
|
||||
|
||||
if (MyCurrentState.isMoving)
|
||||
{
|
||||
var changeMoveDirection = Vector3.ProjectOnPlane(MyCurrentValue.currentMoveDirection, MyCurrentValue.groundNormal).normalized;
|
||||
MyCurrentValue.horizontalVelocity = changeMoveDirection * speed;
|
||||
}
|
||||
else
|
||||
{
|
||||
MyCurrentValue.horizontalVelocity = Vector3.zero;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
MyComponents.rb.useGravity = true;
|
||||
if (MyCurrentState.isForwardBlocked || !MyCurrentState.isGrounded)
|
||||
{
|
||||
MyCurrentValue.horizontalVelocity = Vector3.zero;
|
||||
}
|
||||
else
|
||||
{
|
||||
MyCurrentValue.horizontalVelocity = MyCurrentValue.currentMoveDirection * speed;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> 리지드바디 최종 속도 적용 </summary>
|
||||
private void ApplyMovementsToRigidbody()
|
||||
{
|
||||
Vector3 finalVelocity;
|
||||
if (MyCurrentState.isOutOfControl || MyCurrentState.isOnSteepSlope || !MyCurrentState.isGrounded)
|
||||
{
|
||||
var velocity = MyComponents.rb.velocity;
|
||||
finalVelocity = MyComponents.rb.position + new Vector3(velocity.x, MyCurrentValue.gravity.y, velocity.z) * Time.fixedDeltaTime;
|
||||
MyComponents.rb.MovePosition(finalVelocity);
|
||||
return;
|
||||
}
|
||||
if (MyCurrentValue.horizontalVelocity == Vector3.zero)
|
||||
{
|
||||
MyComponents.rb.velocity = Vector3.zero;
|
||||
return;
|
||||
}
|
||||
|
||||
finalVelocity = MyComponents.rb.position + MyCurrentValue.horizontalVelocity * Time.fixedDeltaTime;
|
||||
MyComponents.rb.MovePosition(finalVelocity);
|
||||
}
|
||||
|
||||
public bool GetIsMoving() => MyCurrentState.isMoving;
|
||||
public bool GetIsDashing() => MyCurrentState.isDashing;
|
||||
public float GetDashCooldown() => MyMovementOption.dashCooldown;
|
||||
public float GetDashTime() => MyMovementOption.dashTime;
|
||||
public void SetIsDashing(bool value) => MyCurrentState.isDashing = value;
|
||||
public void SetEnableDashing(bool value) => MyCurrentState.enableDash = value;
|
||||
public Vector3 GetPreviousMoveDirection() => MyCurrentValue.previousMoveDirection;
|
||||
public void SetAnimator(Animator animator) => MyComponents.animator = animator;
|
||||
|
||||
#endregion
|
||||
|
||||
/***********************************************************************
|
||||
* Gizmos, GUI
|
||||
***********************************************************************/
|
||||
#region Gizmos, GUI
|
||||
|
||||
private Vector3 gzGroundTouch;
|
||||
private Vector3 gzForwardTouch;
|
||||
|
||||
[Header("Gizmos Option")] public bool showGizmos = true;
|
||||
|
||||
[SerializeField, Range(0.01f, 2f)] private float gizmoRadius = 0.05f;
|
||||
|
||||
[System.Diagnostics.Conditional("UNITY_EDITOR")]
|
||||
private void OnDrawGizmos()
|
||||
{
|
||||
if (Application.isPlaying == false) return;
|
||||
if (!showGizmos) return;
|
||||
if (!enabled) return;
|
||||
|
||||
Gizmos.color = Color.red;
|
||||
Gizmos.DrawSphere(gzGroundTouch, gizmoRadius);
|
||||
|
||||
if (MyCurrentState.isForwardBlocked)
|
||||
{
|
||||
Gizmos.color = Color.blue;
|
||||
Gizmos.DrawSphere(gzForwardTouch, gizmoRadius);
|
||||
}
|
||||
|
||||
Gizmos.color = Color.blue;
|
||||
Gizmos.DrawLine(gzGroundTouch - MyCurrentValue.groundCross,
|
||||
gzGroundTouch + MyCurrentValue.groundCross);
|
||||
|
||||
Gizmos.color = new Color(0.5f, 1.0f, 0.8f, 0.8f);
|
||||
Gizmos.DrawWireSphere(CapsuleTopCenterPoint, castRadius);
|
||||
Gizmos.DrawWireSphere(CapsuleBottomCenterPoint, castRadius);
|
||||
}
|
||||
|
||||
[System.Diagnostics.Conditional("UNITY_EDITOR")]
|
||||
private void GizmosUpdateValue<T>(ref T variable, in T value)
|
||||
{
|
||||
variable = value;
|
||||
}
|
||||
|
||||
[SerializeField, Space] private bool showGUI = true;
|
||||
[SerializeField] private int guiTextSize = 28;
|
||||
|
||||
private float prevForwardSlopeAngle;
|
||||
|
||||
private void OnGUI()
|
||||
{
|
||||
if (Application.isPlaying == false) return;
|
||||
if (!showGUI) return;
|
||||
if (!enabled) return;
|
||||
|
||||
GUIStyle labelStyle = GUI.skin.label;
|
||||
labelStyle.normal.textColor = Color.yellow;
|
||||
labelStyle.fontSize = Math.Max(guiTextSize, 20);
|
||||
|
||||
prevForwardSlopeAngle = MyCurrentValue.forwardSlopeAngle == -90f
|
||||
? prevForwardSlopeAngle
|
||||
: MyCurrentValue.forwardSlopeAngle;
|
||||
|
||||
var oldColor = GUI.color;
|
||||
GUI.color = new Color(0f, 0f, 0f, 0.5f);
|
||||
GUI.Box(new Rect(40, 40, 420, 240), "");
|
||||
GUI.color = oldColor;
|
||||
|
||||
GUILayout.BeginArea(new Rect(50, 50, 1000, 500));
|
||||
GUILayout.Label($"Ground Height : {Mathf.Min(MyCurrentValue.groundDistance, 99.99f): 00.00}",
|
||||
labelStyle);
|
||||
GUILayout.Label($"Slope Angle(Ground) : {MyCurrentValue.groundSlopeAngle: 00.00}", labelStyle);
|
||||
GUILayout.Label($"Slope Angle(Forward) : {prevForwardSlopeAngle: 00.00}", labelStyle);
|
||||
GUILayout.Label($"Allowed Slope Angle : {MyMovementOption.maxSlopeAngle: 00.00}", labelStyle);
|
||||
GUILayout.Label($"Current Speed Mag : {MyCurrentValue.horizontalVelocity.magnitude: 00.00}",
|
||||
labelStyle);
|
||||
GUILayout.EndArea();
|
||||
|
||||
float sWidth = Screen.width;
|
||||
float sHeight = Screen.height;
|
||||
|
||||
GUIStyle RTLabelStyle = GUI.skin.label;
|
||||
RTLabelStyle.fontSize = 20;
|
||||
RTLabelStyle.normal.textColor = Color.green;
|
||||
|
||||
oldColor = GUI.color;
|
||||
GUI.color = new Color(1f, 1f, 1f, 0.5f);
|
||||
GUI.Box(new Rect(sWidth - 355f, 5f, 340f, 100f), "");
|
||||
GUI.color = oldColor;
|
||||
|
||||
var yPos = 10f;
|
||||
GUI.Label(new Rect(sWidth - 350f, yPos, 150f, 30f), $"Speed : {MyMovementOption.moveSpeed: 00.00}",
|
||||
RTLabelStyle);
|
||||
MyMovementOption.moveSpeed = GUI.HorizontalSlider(new Rect(sWidth - 200f, yPos + 10f, 180f, 20f),
|
||||
MyMovementOption.moveSpeed, 1f, 10f);
|
||||
|
||||
yPos += 20f;
|
||||
GUI.Label(new Rect(sWidth - 350f, yPos, 150f, 30f), $"Max Slope : {MyMovementOption.maxSlopeAngle: 00}",
|
||||
RTLabelStyle);
|
||||
MyMovementOption.maxSlopeAngle = (int)GUI.HorizontalSlider(
|
||||
new Rect(sWidth - 200f, yPos + 10f, 180f, 20f), MyMovementOption.maxSlopeAngle, 1f, 75f);
|
||||
|
||||
labelStyle.fontSize = Math.Max(guiTextSize, 20);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 01fef22c346a235499c530436f7c9c53
|
@ -5,32 +5,36 @@ namespace BlueWaterProject
|
||||
{
|
||||
public class ComboAttack : StateMachineBehaviour
|
||||
{
|
||||
private CombatPlayer combatPlayer;
|
||||
private CombatPlayerController combatPlayerController;
|
||||
|
||||
public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
|
||||
{
|
||||
if (combatPlayer == null)
|
||||
if (combatPlayerController == null)
|
||||
{
|
||||
combatPlayer = animator.GetComponentInParent<CombatPlayer>();
|
||||
combatPlayerController = animator.GetComponentInParent<CombatPlayerController>();
|
||||
}
|
||||
combatPlayer.IsAttacking = true;
|
||||
combatPlayer.IsComboPossible = true;
|
||||
var animationLength = stateInfo.length;
|
||||
animator.speed = animationLength / combatPlayerController.GetAttackTime();
|
||||
|
||||
combatPlayerController.SetIsAttacking(true);
|
||||
combatPlayerController.SetIsComboPossible(true);
|
||||
}
|
||||
|
||||
public override void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
|
||||
{
|
||||
if (stateInfo.normalizedTime >= 1f)
|
||||
{
|
||||
animator.SetBool(combatPlayer.isAttackingHash, false);
|
||||
animator.SetBool(CombatPlayerController.IsAttackingHash, false);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
|
||||
{
|
||||
combatPlayer.IsComboPossible = false;
|
||||
combatPlayer.IsComboAttacking = false;
|
||||
combatPlayer.IsAttacking = false;
|
||||
animator.SetBool(combatPlayer.isAttackingHash, false);
|
||||
animator.speed = 1f;
|
||||
combatPlayerController.SetIsComboPossible(false);
|
||||
combatPlayerController.SetIsComboAttacking(false);
|
||||
combatPlayerController.SetIsAttacking(false);
|
||||
animator.SetBool(CombatPlayerController.IsAttackingHash, false);
|
||||
}
|
||||
}
|
||||
}
|
@ -5,41 +5,36 @@ namespace BlueWaterProject
|
||||
{
|
||||
public class Dash : StateMachineBehaviour
|
||||
{
|
||||
private CombatPlayer combatPlayer;
|
||||
private CombatPlayerController combatPlayerController;
|
||||
|
||||
public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
|
||||
{
|
||||
if (combatPlayer == null)
|
||||
if (combatPlayerController == null)
|
||||
{
|
||||
combatPlayer = animator.GetComponentInParent<CombatPlayer>();
|
||||
combatPlayerController = animator.GetComponentInParent<CombatPlayerController>();
|
||||
}
|
||||
combatPlayer.IsDashing = true;
|
||||
combatPlayer.EnableDash = false;
|
||||
var animationLength = stateInfo.length;
|
||||
animator.speed = animationLength / combatPlayerController.GetDashTime();
|
||||
|
||||
combatPlayerController.SetIsDashing(true);
|
||||
combatPlayerController.SetEnableDashing(false);
|
||||
}
|
||||
|
||||
public override void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
|
||||
{
|
||||
// var dashDirection = combatPlayer.PreviousDirection;
|
||||
//
|
||||
// if (combatPlayer.IsOnSlope())
|
||||
// {
|
||||
// dashDirection = Vector3.ProjectOnPlane(dashDirection, combatPlayer.GetSlopeHit().normal).normalized;
|
||||
// }
|
||||
//
|
||||
// combatPlayer.Rb.velocity = dashDirection * combatPlayer.DashForce;
|
||||
|
||||
if (stateInfo.normalizedTime >= 1.0f)
|
||||
{
|
||||
animator.SetBool(combatPlayer.isDashingHash, false);
|
||||
animator.SetBool(PhysicsMovement.IsDashingHash, false);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
|
||||
{
|
||||
combatPlayer.IsDashing = false;
|
||||
animator.SetBool(combatPlayer.isDashingHash, false);
|
||||
animator.speed = 1f;
|
||||
combatPlayerController.SetIsDashing(false);
|
||||
animator.SetBool(PhysicsMovement.IsDashingHash, false);
|
||||
|
||||
combatPlayer.CoolDown(combatPlayer.DashCooldown, () => combatPlayer.EnableDash = true);
|
||||
combatPlayerController.CoolDown(combatPlayerController.GetDashCooldown(), () => combatPlayerController.SetEnableDashing(true));
|
||||
}
|
||||
}
|
||||
}
|
23
BlueWater/Assets/02.Scripts/Interface/IMovement3D.cs
Normal file
23
BlueWater/Assets/02.Scripts/Interface/IMovement3D.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using UnityEngine;
|
||||
|
||||
// ReSharper disable once CheckNamespace
|
||||
namespace BlueWaterProject
|
||||
{
|
||||
public interface IMovement3D
|
||||
{
|
||||
/// <summary> 현재 이동 중인지 여부 </summary>
|
||||
bool IsMoving();
|
||||
/// <summary> 지면에 닿아 있는지 여부 </summary>
|
||||
bool IsGrounded();
|
||||
/// <summary> 지면으로부터의 거리 </summary>
|
||||
float GetDistanceFromGround();
|
||||
|
||||
/// <summary> 월드 이동벡터 초기화(이동 명령) </summary>
|
||||
void SetMovement(in Vector3 worldMoveDirection, bool isRunning);
|
||||
/// <summary> 이동 중지 </summary>
|
||||
void StopMoving();
|
||||
|
||||
/// <summary> 밀쳐내기 </summary>
|
||||
void KnockBack(in Vector3 force, float time);
|
||||
}
|
||||
}
|
11
BlueWater/Assets/02.Scripts/Interface/IMovement3D.cs.meta
Normal file
11
BlueWater/Assets/02.Scripts/Interface/IMovement3D.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d1165eeeca2febd42b2f40167c74d02f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,101 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!74 &7400000
|
||||
AnimationClip:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: BackDash
|
||||
serializedVersion: 7
|
||||
m_Legacy: 0
|
||||
m_Compressed: 0
|
||||
m_UseHighQualityCurve: 1
|
||||
m_RotationCurves: []
|
||||
m_CompressedRotationCurves: []
|
||||
m_EulerCurves: []
|
||||
m_PositionCurves: []
|
||||
m_ScaleCurves: []
|
||||
m_FloatCurves: []
|
||||
m_PPtrCurves:
|
||||
- serializedVersion: 2
|
||||
curve:
|
||||
- time: 0
|
||||
value: {fileID: 4010818287206423529, guid: 3799083e0fb2447b58c45499eaf37bd0,
|
||||
type: 3}
|
||||
- time: 0.08
|
||||
value: {fileID: -4053654354307959872, guid: 3799083e0fb2447b58c45499eaf37bd0,
|
||||
type: 3}
|
||||
- time: 0.16
|
||||
value: {fileID: 4124850773902862070, guid: 3799083e0fb2447b58c45499eaf37bd0,
|
||||
type: 3}
|
||||
- time: 0.24
|
||||
value: {fileID: -4366721053727917600, guid: 3799083e0fb2447b58c45499eaf37bd0,
|
||||
type: 3}
|
||||
- time: 0.32
|
||||
value: {fileID: -3589362433014018674, guid: 3799083e0fb2447b58c45499eaf37bd0,
|
||||
type: 3}
|
||||
- time: 0.4
|
||||
value: {fileID: 1363422056328517653, guid: 3799083e0fb2447b58c45499eaf37bd0,
|
||||
type: 3}
|
||||
- time: 0.48
|
||||
value: {fileID: -3862805103302402338, guid: 3799083e0fb2447b58c45499eaf37bd0,
|
||||
type: 3}
|
||||
- time: 0.56
|
||||
value: {fileID: -3862805103302402338, guid: 3799083e0fb2447b58c45499eaf37bd0,
|
||||
type: 3}
|
||||
attribute: m_Sprite
|
||||
path:
|
||||
classID: 212
|
||||
script: {fileID: 0}
|
||||
flags: 2
|
||||
m_SampleRate: 100
|
||||
m_WrapMode: 0
|
||||
m_Bounds:
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
m_Extent: {x: 0, y: 0, z: 0}
|
||||
m_ClipBindingConstant:
|
||||
genericBindings:
|
||||
- serializedVersion: 2
|
||||
path: 0
|
||||
attribute: 0
|
||||
script: {fileID: 0}
|
||||
typeID: 212
|
||||
customType: 23
|
||||
isPPtrCurve: 1
|
||||
isIntCurve: 0
|
||||
isSerializeReferenceCurve: 0
|
||||
pptrCurveMapping:
|
||||
- {fileID: 4010818287206423529, guid: 3799083e0fb2447b58c45499eaf37bd0, type: 3}
|
||||
- {fileID: -4053654354307959872, guid: 3799083e0fb2447b58c45499eaf37bd0, type: 3}
|
||||
- {fileID: 4124850773902862070, guid: 3799083e0fb2447b58c45499eaf37bd0, type: 3}
|
||||
- {fileID: -4366721053727917600, guid: 3799083e0fb2447b58c45499eaf37bd0, type: 3}
|
||||
- {fileID: -3589362433014018674, guid: 3799083e0fb2447b58c45499eaf37bd0, type: 3}
|
||||
- {fileID: 1363422056328517653, guid: 3799083e0fb2447b58c45499eaf37bd0, type: 3}
|
||||
- {fileID: -3862805103302402338, guid: 3799083e0fb2447b58c45499eaf37bd0, type: 3}
|
||||
- {fileID: -3862805103302402338, guid: 3799083e0fb2447b58c45499eaf37bd0, type: 3}
|
||||
m_AnimationClipSettings:
|
||||
serializedVersion: 2
|
||||
m_AdditiveReferencePoseClip: {fileID: 0}
|
||||
m_AdditiveReferencePoseTime: 0
|
||||
m_StartTime: 0
|
||||
m_StopTime: 0.57
|
||||
m_OrientationOffsetY: 0
|
||||
m_Level: 0
|
||||
m_CycleOffset: 0
|
||||
m_HasAdditiveReferencePose: 0
|
||||
m_LoopTime: 1
|
||||
m_LoopBlend: 0
|
||||
m_LoopBlendOrientation: 0
|
||||
m_LoopBlendPositionY: 0
|
||||
m_LoopBlendPositionXZ: 0
|
||||
m_KeepOriginalOrientation: 0
|
||||
m_KeepOriginalPositionY: 0
|
||||
m_KeepOriginalPositionXZ: 0
|
||||
m_HeightFromFeet: 0
|
||||
m_Mirror: 0
|
||||
m_EditorCurves: []
|
||||
m_EulerEditorCurves: []
|
||||
m_HasGenericRootTransform: 0
|
||||
m_HasMotionFloatCurves: 0
|
||||
m_Events: []
|
@ -1,7 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aba6fa52907672a4da99307e9c925639
|
||||
DefaultImporter:
|
||||
guid: 8fe0fe11deca7064aaba73b53537cbb8
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 7400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,101 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!74 &7400000
|
||||
AnimationClip:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: FrontDash
|
||||
serializedVersion: 7
|
||||
m_Legacy: 0
|
||||
m_Compressed: 0
|
||||
m_UseHighQualityCurve: 1
|
||||
m_RotationCurves: []
|
||||
m_CompressedRotationCurves: []
|
||||
m_EulerCurves: []
|
||||
m_PositionCurves: []
|
||||
m_ScaleCurves: []
|
||||
m_FloatCurves: []
|
||||
m_PPtrCurves:
|
||||
- serializedVersion: 2
|
||||
curve:
|
||||
- time: 0
|
||||
value: {fileID: -9154204961782164589, guid: 88b84319f88e542e495fc1f6338dc3ab,
|
||||
type: 3}
|
||||
- time: 0.08
|
||||
value: {fileID: -3658744280763577496, guid: 88b84319f88e542e495fc1f6338dc3ab,
|
||||
type: 3}
|
||||
- time: 0.16
|
||||
value: {fileID: -2197278150333076600, guid: 88b84319f88e542e495fc1f6338dc3ab,
|
||||
type: 3}
|
||||
- time: 0.24
|
||||
value: {fileID: 5445867137363800702, guid: 88b84319f88e542e495fc1f6338dc3ab,
|
||||
type: 3}
|
||||
- time: 0.32
|
||||
value: {fileID: -8674120543164084762, guid: 88b84319f88e542e495fc1f6338dc3ab,
|
||||
type: 3}
|
||||
- time: 0.4
|
||||
value: {fileID: 7659963852650702022, guid: 88b84319f88e542e495fc1f6338dc3ab,
|
||||
type: 3}
|
||||
- time: 0.48
|
||||
value: {fileID: -604151334296838673, guid: 88b84319f88e542e495fc1f6338dc3ab,
|
||||
type: 3}
|
||||
- time: 0.56
|
||||
value: {fileID: -604151334296838673, guid: 88b84319f88e542e495fc1f6338dc3ab,
|
||||
type: 3}
|
||||
attribute: m_Sprite
|
||||
path:
|
||||
classID: 212
|
||||
script: {fileID: 0}
|
||||
flags: 2
|
||||
m_SampleRate: 100
|
||||
m_WrapMode: 0
|
||||
m_Bounds:
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
m_Extent: {x: 0, y: 0, z: 0}
|
||||
m_ClipBindingConstant:
|
||||
genericBindings:
|
||||
- serializedVersion: 2
|
||||
path: 0
|
||||
attribute: 0
|
||||
script: {fileID: 0}
|
||||
typeID: 212
|
||||
customType: 23
|
||||
isPPtrCurve: 1
|
||||
isIntCurve: 0
|
||||
isSerializeReferenceCurve: 0
|
||||
pptrCurveMapping:
|
||||
- {fileID: -9154204961782164589, guid: 88b84319f88e542e495fc1f6338dc3ab, type: 3}
|
||||
- {fileID: -3658744280763577496, guid: 88b84319f88e542e495fc1f6338dc3ab, type: 3}
|
||||
- {fileID: -2197278150333076600, guid: 88b84319f88e542e495fc1f6338dc3ab, type: 3}
|
||||
- {fileID: 5445867137363800702, guid: 88b84319f88e542e495fc1f6338dc3ab, type: 3}
|
||||
- {fileID: -8674120543164084762, guid: 88b84319f88e542e495fc1f6338dc3ab, type: 3}
|
||||
- {fileID: 7659963852650702022, guid: 88b84319f88e542e495fc1f6338dc3ab, type: 3}
|
||||
- {fileID: -604151334296838673, guid: 88b84319f88e542e495fc1f6338dc3ab, type: 3}
|
||||
- {fileID: -604151334296838673, guid: 88b84319f88e542e495fc1f6338dc3ab, type: 3}
|
||||
m_AnimationClipSettings:
|
||||
serializedVersion: 2
|
||||
m_AdditiveReferencePoseClip: {fileID: 0}
|
||||
m_AdditiveReferencePoseTime: 0
|
||||
m_StartTime: 0
|
||||
m_StopTime: 0.57
|
||||
m_OrientationOffsetY: 0
|
||||
m_Level: 0
|
||||
m_CycleOffset: 0
|
||||
m_HasAdditiveReferencePose: 0
|
||||
m_LoopTime: 1
|
||||
m_LoopBlend: 0
|
||||
m_LoopBlendOrientation: 0
|
||||
m_LoopBlendPositionY: 0
|
||||
m_LoopBlendPositionXZ: 0
|
||||
m_KeepOriginalOrientation: 0
|
||||
m_KeepOriginalPositionY: 0
|
||||
m_KeepOriginalPositionXZ: 0
|
||||
m_HeightFromFeet: 0
|
||||
m_Mirror: 0
|
||||
m_EditorCurves: []
|
||||
m_EulerEditorCurves: []
|
||||
m_HasGenericRootTransform: 0
|
||||
m_HasMotionFloatCurves: 0
|
||||
m_Events: []
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ca3c514e04cb41a48816d372ab1e9071
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 7400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,101 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!74 &7400000
|
||||
AnimationClip:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: SideDash
|
||||
serializedVersion: 7
|
||||
m_Legacy: 0
|
||||
m_Compressed: 0
|
||||
m_UseHighQualityCurve: 1
|
||||
m_RotationCurves: []
|
||||
m_CompressedRotationCurves: []
|
||||
m_EulerCurves: []
|
||||
m_PositionCurves: []
|
||||
m_ScaleCurves: []
|
||||
m_FloatCurves: []
|
||||
m_PPtrCurves:
|
||||
- serializedVersion: 2
|
||||
curve:
|
||||
- time: 0
|
||||
value: {fileID: 3033537662187923395, guid: defcc8125c9264ebc9dc3d4026bcb572,
|
||||
type: 3}
|
||||
- time: 0.08
|
||||
value: {fileID: -2693056187368311098, guid: defcc8125c9264ebc9dc3d4026bcb572,
|
||||
type: 3}
|
||||
- time: 0.16
|
||||
value: {fileID: 5184523171927287766, guid: defcc8125c9264ebc9dc3d4026bcb572,
|
||||
type: 3}
|
||||
- time: 0.24
|
||||
value: {fileID: -8235170841148880371, guid: defcc8125c9264ebc9dc3d4026bcb572,
|
||||
type: 3}
|
||||
- time: 0.32
|
||||
value: {fileID: -1750194370219178006, guid: defcc8125c9264ebc9dc3d4026bcb572,
|
||||
type: 3}
|
||||
- time: 0.4
|
||||
value: {fileID: 4756864213286410935, guid: defcc8125c9264ebc9dc3d4026bcb572,
|
||||
type: 3}
|
||||
- time: 0.48
|
||||
value: {fileID: 4040061753010727598, guid: defcc8125c9264ebc9dc3d4026bcb572,
|
||||
type: 3}
|
||||
- time: 0.56
|
||||
value: {fileID: 6229803037504010689, guid: defcc8125c9264ebc9dc3d4026bcb572,
|
||||
type: 3}
|
||||
attribute: m_Sprite
|
||||
path:
|
||||
classID: 212
|
||||
script: {fileID: 0}
|
||||
flags: 2
|
||||
m_SampleRate: 100
|
||||
m_WrapMode: 0
|
||||
m_Bounds:
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
m_Extent: {x: 0, y: 0, z: 0}
|
||||
m_ClipBindingConstant:
|
||||
genericBindings:
|
||||
- serializedVersion: 2
|
||||
path: 0
|
||||
attribute: 0
|
||||
script: {fileID: 0}
|
||||
typeID: 212
|
||||
customType: 23
|
||||
isPPtrCurve: 1
|
||||
isIntCurve: 0
|
||||
isSerializeReferenceCurve: 0
|
||||
pptrCurveMapping:
|
||||
- {fileID: 3033537662187923395, guid: defcc8125c9264ebc9dc3d4026bcb572, type: 3}
|
||||
- {fileID: -2693056187368311098, guid: defcc8125c9264ebc9dc3d4026bcb572, type: 3}
|
||||
- {fileID: 5184523171927287766, guid: defcc8125c9264ebc9dc3d4026bcb572, type: 3}
|
||||
- {fileID: -8235170841148880371, guid: defcc8125c9264ebc9dc3d4026bcb572, type: 3}
|
||||
- {fileID: -1750194370219178006, guid: defcc8125c9264ebc9dc3d4026bcb572, type: 3}
|
||||
- {fileID: 4756864213286410935, guid: defcc8125c9264ebc9dc3d4026bcb572, type: 3}
|
||||
- {fileID: 4040061753010727598, guid: defcc8125c9264ebc9dc3d4026bcb572, type: 3}
|
||||
- {fileID: 6229803037504010689, guid: defcc8125c9264ebc9dc3d4026bcb572, type: 3}
|
||||
m_AnimationClipSettings:
|
||||
serializedVersion: 2
|
||||
m_AdditiveReferencePoseClip: {fileID: 0}
|
||||
m_AdditiveReferencePoseTime: 0
|
||||
m_StartTime: 0
|
||||
m_StopTime: 0.57
|
||||
m_OrientationOffsetY: 0
|
||||
m_Level: 0
|
||||
m_CycleOffset: 0
|
||||
m_HasAdditiveReferencePose: 0
|
||||
m_LoopTime: 1
|
||||
m_LoopBlend: 0
|
||||
m_LoopBlendOrientation: 0
|
||||
m_LoopBlendPositionY: 0
|
||||
m_LoopBlendPositionXZ: 0
|
||||
m_KeepOriginalOrientation: 0
|
||||
m_KeepOriginalPositionY: 0
|
||||
m_KeepOriginalPositionXZ: 0
|
||||
m_HeightFromFeet: 0
|
||||
m_Mirror: 0
|
||||
m_EditorCurves: []
|
||||
m_EulerEditorCurves: []
|
||||
m_HasGenericRootTransform: 0
|
||||
m_HasMotionFloatCurves: 0
|
||||
m_Events: []
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9f05bb89ed7085e43a607922b7f14ae9
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 7400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -12,7 +12,6 @@ GameObject:
|
||||
- component: {fileID: 1564585232883027199}
|
||||
- component: {fileID: 3138574858532492034}
|
||||
- component: {fileID: 6230115818254112785}
|
||||
- component: {fileID: 6407473152449951742}
|
||||
m_Layer: 0
|
||||
m_Name: VisualLook
|
||||
m_TagString: Untagged
|
||||
@ -124,28 +123,6 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: e16f62f7d451b504fae5474be03a6da7, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!64 &6407473152449951742
|
||||
MeshCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 87732673861481097}
|
||||
m_Material: {fileID: 0}
|
||||
m_IncludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ExcludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_LayerOverridePriority: 0
|
||||
m_IsTrigger: 0
|
||||
m_ProvidesContacts: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 5
|
||||
m_Convex: 0
|
||||
m_CookingOptions: 30
|
||||
m_Mesh: {fileID: 0}
|
||||
--- !u!1 &2391945466483065398
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -158,8 +135,8 @@ GameObject:
|
||||
- component: {fileID: 6858674358337067996}
|
||||
- component: {fileID: 7729150195808218711}
|
||||
- component: {fileID: 6121288256300454469}
|
||||
- component: {fileID: 4906016173319036404}
|
||||
- component: {fileID: 2650321273105086144}
|
||||
- component: {fileID: 5799904028004926704}
|
||||
- component: {fileID: 803982772767150407}
|
||||
m_Layer: 9
|
||||
m_Name: CombatPlayer
|
||||
m_TagString: Untagged
|
||||
@ -181,7 +158,6 @@ Transform:
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 8557381169392297019}
|
||||
- {fileID: 7407663186225048994}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!136 &6858674358337067996
|
||||
@ -231,9 +207,9 @@ Rigidbody:
|
||||
m_ImplicitTensor: 1
|
||||
m_UseGravity: 1
|
||||
m_IsKinematic: 0
|
||||
m_Interpolate: 0
|
||||
m_Interpolate: 1
|
||||
m_Constraints: 112
|
||||
m_CollisionDetection: 0
|
||||
m_CollisionDetection: 2
|
||||
--- !u!114 &6121288256300454469
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -265,7 +241,7 @@ MonoBehaviour:
|
||||
m_DefaultActionMap: Player
|
||||
m_SplitScreenIndex: -1
|
||||
m_Camera: {fileID: 0}
|
||||
--- !u!114 &4906016173319036404
|
||||
--- !u!114 &5799904028004926704
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
@ -274,85 +250,82 @@ MonoBehaviour:
|
||||
m_GameObject: {fileID: 2391945466483065398}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 5258cddac7934c1469d147dddbdb5023, type: 3}
|
||||
m_Script: {fileID: 11500000, guid: d85ab5237d86f7a43a553f00be353476, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
autoInit: 0
|
||||
maxHp: 100
|
||||
currentHp: 0
|
||||
moveSpeed: 10
|
||||
maxSlopeAngle: 50
|
||||
<DashForce>k__BackingField: 20
|
||||
<DashCooldown>k__BackingField: 0.5
|
||||
<IsDashing>k__BackingField: 0
|
||||
<EnableDash>k__BackingField: 1
|
||||
<MaxHitNum>k__BackingField: 10
|
||||
<AttackDamage>k__BackingField: 10
|
||||
<AttackRange>k__BackingField: 1.5
|
||||
<AttackAngle>k__BackingField: 180
|
||||
<ComboTime>k__BackingField: 0.5
|
||||
<TargetLayer>k__BackingField:
|
||||
serializedVersion: 2
|
||||
m_Bits: 8192
|
||||
<IsAttacking>k__BackingField: 0
|
||||
<IsComboAttacking>k__BackingField: 0
|
||||
<IsComboPossible>k__BackingField: 0
|
||||
playerInput: {fileID: 6121288256300454469}
|
||||
<Rb>k__BackingField: {fileID: 7729150195808218711}
|
||||
visualLook: {fileID: 8557381169392297019}
|
||||
<Animator>k__BackingField: {fileID: 3138574858532492034}
|
||||
groundCheck: {fileID: 7407663186225048994}
|
||||
<HitColliders>k__BackingField: []
|
||||
--- !u!64 &2650321273105086144
|
||||
MeshCollider:
|
||||
<MyComponents>k__BackingField:
|
||||
playerInput: {fileID: 6121288256300454469}
|
||||
visualLook: {fileID: 8557381169392297019}
|
||||
animator: {fileID: 3138574858532492034}
|
||||
movement: {fileID: 803982772767150407}
|
||||
<MyCharacterOption>k__BackingField:
|
||||
maxHp: 100
|
||||
maxHitNum: 10
|
||||
attackDamage: 10
|
||||
attackRange: 1.5
|
||||
attackAngle: 180
|
||||
comboTime: 0.5
|
||||
targetLayer:
|
||||
serializedVersion: 2
|
||||
m_Bits: 512
|
||||
<MyCurrentState>k__BackingField:
|
||||
isAttacking: 0
|
||||
isComboPossible: 0
|
||||
isComboAttacking: 0
|
||||
<MyCurrentValue>k__BackingField:
|
||||
currentHp: 0
|
||||
hitColliders: []
|
||||
--- !u!114 &803982772767150407
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2391945466483065398}
|
||||
m_Material: {fileID: 0}
|
||||
m_IncludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ExcludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_LayerOverridePriority: 0
|
||||
m_IsTrigger: 0
|
||||
m_ProvidesContacts: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 5
|
||||
m_Convex: 0
|
||||
m_CookingOptions: 30
|
||||
m_Mesh: {fileID: 0}
|
||||
--- !u!1 &3669261844365681366
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 7407663186225048994}
|
||||
m_Layer: 9
|
||||
m_Name: GroundCheck
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &7407663186225048994
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3669261844365681366}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 8934240191915016273}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 01fef22c346a235499c530436f7c9c53, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
<MyComponents>k__BackingField:
|
||||
capsuleCollider: {fileID: 6858674358337067996}
|
||||
rb: {fileID: 7729150195808218711}
|
||||
animator: {fileID: 0}
|
||||
<MyCheckOption>k__BackingField:
|
||||
groundLayer:
|
||||
serializedVersion: 2
|
||||
m_Bits: 8
|
||||
forwardCheckDistance: 0.1
|
||||
groundCheckDistance: 2
|
||||
groundCheckThreshold: 0.01
|
||||
<MyMovementOption>k__BackingField:
|
||||
moveSpeed: 10
|
||||
maxSlopeAngle: 50
|
||||
dashSpeed: 30
|
||||
dashTime: 0.2
|
||||
dashCooldown: 0.5
|
||||
<MyCurrentState>k__BackingField:
|
||||
isMoving: 0
|
||||
isGrounded: 0
|
||||
isOnSlope: 0
|
||||
isOnSteepSlope: 0
|
||||
isForwardBlocked: 0
|
||||
isOutOfControl: 0
|
||||
isDashing: 0
|
||||
enableDash: 1
|
||||
<MyCurrentValue>k__BackingField:
|
||||
movementInput: {x: 0, y: 0}
|
||||
currentMoveDirection: {x: 0, y: 0, z: 0}
|
||||
previousMoveDirection: {x: 0, y: 0, z: -1}
|
||||
groundNormal: {x: 0, y: 0, z: 0}
|
||||
groundCross: {x: 0, y: 0, z: 0}
|
||||
horizontalVelocity: {x: 0, y: 0, z: 0}
|
||||
outOfControlDuration: 0
|
||||
groundDistance: 0
|
||||
groundSlopeAngle: 0
|
||||
forwardSlopeAngle: 0
|
||||
gravity: {x: 0, y: 0, z: 0}
|
||||
showGizmos: 1
|
||||
gizmoRadius: 0.05
|
||||
showGUI: 1
|
||||
guiTextSize: 28
|
||||
|
@ -697,8 +697,7 @@ BlendTree:
|
||||
m_Name: Blend Tree
|
||||
m_Childs:
|
||||
- serializedVersion: 2
|
||||
m_Motion: {fileID: -8444228808809566427, guid: 88b84319f88e542e495fc1f6338dc3ab,
|
||||
type: 3}
|
||||
m_Motion: {fileID: 7400000, guid: ca3c514e04cb41a48816d372ab1e9071, type: 2}
|
||||
m_Threshold: 0
|
||||
m_Position: {x: 0, y: -1}
|
||||
m_TimeScale: 1
|
||||
@ -706,8 +705,7 @@ BlendTree:
|
||||
m_DirectBlendParameter: Blend
|
||||
m_Mirror: 0
|
||||
- serializedVersion: 2
|
||||
m_Motion: {fileID: -8444228808809566427, guid: defcc8125c9264ebc9dc3d4026bcb572,
|
||||
type: 3}
|
||||
m_Motion: {fileID: 7400000, guid: 9f05bb89ed7085e43a607922b7f14ae9, type: 2}
|
||||
m_Threshold: 0.33333334
|
||||
m_Position: {x: -0.9, y: 0}
|
||||
m_TimeScale: 1
|
||||
@ -715,8 +713,7 @@ BlendTree:
|
||||
m_DirectBlendParameter: Blend
|
||||
m_Mirror: 0
|
||||
- serializedVersion: 2
|
||||
m_Motion: {fileID: -8444228808809566427, guid: defcc8125c9264ebc9dc3d4026bcb572,
|
||||
type: 3}
|
||||
m_Motion: {fileID: 7400000, guid: 9f05bb89ed7085e43a607922b7f14ae9, type: 2}
|
||||
m_Threshold: 0.6666667
|
||||
m_Position: {x: 0.9, y: 0}
|
||||
m_TimeScale: 1
|
||||
@ -724,8 +721,7 @@ BlendTree:
|
||||
m_DirectBlendParameter: Blend
|
||||
m_Mirror: 0
|
||||
- serializedVersion: 2
|
||||
m_Motion: {fileID: -8444228808809566427, guid: 3799083e0fb2447b58c45499eaf37bd0,
|
||||
type: 3}
|
||||
m_Motion: {fileID: 7400000, guid: 8fe0fe11deca7064aaba73b53537cbb8, type: 2}
|
||||
m_Threshold: 1
|
||||
m_Position: {x: 0, y: 1}
|
||||
m_TimeScale: 1
|
||||
@ -759,7 +755,7 @@ AnimatorState:
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: DashState
|
||||
m_Speed: 3
|
||||
m_Speed: 1
|
||||
m_CycleOffset: 0
|
||||
m_Transitions:
|
||||
- {fileID: -4120808473508093546}
|
||||
|
Loading…
Reference in New Issue
Block a user