
오늘 학습 키워드
최종 팀 프로젝트
오늘 학습 한 내용을 나만의 언어로 정리하기
패링 변경
- 모션을 바꿈
모션 선후딜 줄이기
- 앞뒤에 프레임을 몇 개 줄임
벽 점프하고 플랫폼에 닿으면 무한 점프하던 문제
- Transition을 추가하지 않아서 생겼던 문제였음
사운드
- 효과음 추가 중
학습하며 겪었던 문제점 & 에러
- 문제&에러에 대한 정의
패링을 해도 몬스터가 경직을 안먹었음
- 해결 방법
await 순서 때문에 그런거였음. 모든 로직이 끝나고 애니메이션을 송출해야되는데 반대로 하다보니까 패링이 무시된 듯?
private async void OnTriggerEnter2D(Collider2D other)
{
if (controller.Attack.isStartParry)
{
if (other.TryGetComponent(out ICountable countable))
{
Debug.Log("[플레이어] 플레이어 패링 시도");
if (other.TryGetComponent(out MonsterAttackController attackController))
{
if (attackController.GetIsCountable())
{
controller.Attack.successParry = true;
controller.Condition.SetInvincible(controller.Data.parryInvincibleTime);
controller.Attack.JustSpecialAttack(other.gameObject.GetComponentInChildren<Animator>());
Debug.Log("[플레이어] 플레이어 패링 성공");
countable.CounterAttacked();
// controller.Attack.successParry = false;
await EffectManager.Instance.PlayEffectByIdAndTypeAsync(PlayerEffectID.SuccessParrying, EffectType.Sprite, null,
controller.transform.position + ((other.transform.position - controller.transform.position).normalized
* Vector2.Distance(other.transform.position, controller.transform.position) * 0.5f));
}
}
}
return;
}
if (controller.Attack.isStartJustAttack)
{
if (other.TryGetComponent(out ICountable countable))
{
if (other.TryGetComponent(out MonsterAttackController attackController))
{
if (attackController.GetIsCountable())
{
Debug.Log("[플레이어] 플레이어 저스트 어택!");
controller.Attack.successJustAttack = true;
controller.Condition.SetInvincible(0.5f + controller.Attack.justAttackStopTime);
controller.Attack.SetDamage(controller.Data.justSpecialAttackDamage);
controller.Attack.JustSpecialAttack(other.gameObject.GetComponentInChildren<Animator>());
countable.CounterAttacked();
controller.Attack.successJustAttack = false;
await EffectManager.Instance.PlayEffectsByIdAsync(PlayerEffectID.JustSpecialAttack, EffectOrder.Player, null,
controller.transform.position + ((other.transform.position - controller.transform.position).normalized
* Vector2.Distance(other.transform.position, controller.transform.position) * 0.5f));
}
}
else
{
controller.Condition.SetInvincible(0.5f + controller.Attack.justAttackStopTime);
countable.CounterAttacked();
}
}
}
if (other.TryGetComponent<IDamagable>(out var damagable))
{
ShakeCameraUsingState();
damagable?.TakeDamage(attack.AttackDamage + attack.AdditionalDamage);
if (!controller.Attack.successJustAttack) await EffectManager.Instance.PlayEffectsByIdAsync(PlayerEffectID.NormalAttack, EffectOrder.Player,
null,
controller.transform.position + ((other.transform.position - controller.transform.position).normalized
* Vector2.Distance(other.transform.position, controller.transform.position) * 0.5f));
Debug.Log($"[플레이어] 플레이어가 몬스터에게 {attack.AttackDamage + attack.AdditionalDamage} 만큼 데미지 줌");
}
}