parent
d14dd89c50
commit
620e91a20a
@ -49,6 +49,7 @@ public class EnemyControllerEditor : Editor
|
||||
EditorGUILayout.EndVertical();
|
||||
|
||||
EditorGUILayout.Space();
|
||||
GUI.backgroundColor= Color.clear;
|
||||
EditorGUILayout.LabelField("상태 변경", EditorStyles.boldLabel);
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
|
BIN
Assets/JYY/Animation/Attack01 Slice.anim
(Stored with Git LFS)
Normal file
BIN
Assets/JYY/Animation/Attack01 Slice.anim
(Stored with Git LFS)
Normal file
Binary file not shown.
8
Assets/JYY/Animation/Attack01 Slice.anim.meta
Normal file
8
Assets/JYY/Animation/Attack01 Slice.anim.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: df0c94f0a0eae85438a0bfc0deea8791
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 7400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
BIN
Assets/JYY/Animation/Attack01.anim
(Stored with Git LFS)
BIN
Assets/JYY/Animation/Attack01.anim
(Stored with Git LFS)
Binary file not shown.
@ -1,8 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6019f1b4a095b0b4396f5561a51fee89
|
||||
timeCreated: 1544605028
|
||||
licenseType: Store
|
||||
guid: 34b2cc555a0977644ab2d9e2350a939d
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 7400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
BIN
Assets/JYY/Animation/Attack02.anim
(Stored with Git LFS)
BIN
Assets/JYY/Animation/Attack02.anim
(Stored with Git LFS)
Binary file not shown.
3
Assets/JYY/Animation/ShakeSword.anim
Normal file
3
Assets/JYY/Animation/ShakeSword.anim
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:5a90fe33bc8ca56649ae0d4bc09a37bbd8a0c1312ba47f84aafe8472e01d997d
|
||||
size 349048
|
8
Assets/JYY/Animation/ShakeSword.anim.meta
Normal file
8
Assets/JYY/Animation/ShakeSword.anim.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8cda71f7a8c35a448a6e9999adab5bc1
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 7400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
BIN
Assets/JYY/Animation/WindUp.anim
(Stored with Git LFS)
Normal file
BIN
Assets/JYY/Animation/WindUp.anim
(Stored with Git LFS)
Normal file
Binary file not shown.
8
Assets/JYY/Animation/WindUp.anim.meta
Normal file
8
Assets/JYY/Animation/WindUp.anim.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8d4a1a2c3f67c5c45a3a85dbf83e008b
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 7400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
BIN
Assets/JYY/Animator/PldDogControl.controller
(Stored with Git LFS)
BIN
Assets/JYY/Animator/PldDogControl.controller
(Stored with Git LFS)
Binary file not shown.
BIN
Assets/JYY/Scenes/MonsterTest.unity
(Stored with Git LFS)
BIN
Assets/JYY/Scenes/MonsterTest.unity
(Stored with Git LFS)
Binary file not shown.
14
Assets/Scripts/Character/Enemy/EnemyAnimatorStateAttack.cs
Normal file
14
Assets/Scripts/Character/Enemy/EnemyAnimatorStateAttack.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class EnemyAnimatorStateAttack : StateMachineBehaviour
|
||||
{
|
||||
// OnStateExit is called when a transition ends and the state machine finishes evaluating this state
|
||||
// override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
|
||||
// {
|
||||
// animator.gameObject.GetComponent<EnemyController>().SetState(EnemyState.Trace);
|
||||
// }
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a5765847dbef51e4f9bccde712eeda30
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -20,9 +20,12 @@ public abstract class EnemyController : CharacterBase
|
||||
public float WalkSpeed => walkSpeed;
|
||||
public float RunSpeed => runSpeed;
|
||||
|
||||
public Transform TraceTargetTransform { get; private set; }
|
||||
|
||||
[SerializeField] private float walkSpeed = 5;
|
||||
[SerializeField] private float runSpeed = 8;
|
||||
|
||||
|
||||
// -----
|
||||
// 상태 변수
|
||||
private EnemyStateIdle _enemyStateIdle;
|
||||
@ -86,15 +89,16 @@ public abstract class EnemyController : CharacterBase
|
||||
#region 적 탐지
|
||||
|
||||
// 일정 반경에 플레이어가 진입하면 플레이어 소리를 감지했다고 판단
|
||||
// TODO : 상태 변경시 바로 앞에 플레이어가 있으면 찾지 못하는 이슈 있음
|
||||
public Transform DetectPlayerInCircle()
|
||||
{
|
||||
var hitColliders = Physics.OverlapSphere(transform.position,
|
||||
detectCircleRadius, targetLayerMask);
|
||||
if (hitColliders.Length > 0)
|
||||
{
|
||||
return hitColliders[0].transform;
|
||||
TraceTargetTransform = hitColliders[0].transform;
|
||||
return TraceTargetTransform;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -4,39 +4,52 @@ using UnityEngine;
|
||||
public class EnemyStateAttack : IEnemyState
|
||||
{
|
||||
private EnemyController _enemyController;
|
||||
private Animator _animator;
|
||||
private Coroutine _attackRoutine;
|
||||
|
||||
public void Enter(EnemyController enemyController)
|
||||
{
|
||||
_enemyController = enemyController;
|
||||
_enemyController.EnemyAnimator.SetTrigger("Attack");
|
||||
_animator = _enemyController.EnemyAnimator;
|
||||
|
||||
_animator.SetBool("Attack", true);
|
||||
_attackRoutine = _enemyController.StartCoroutine(AttackSequence());
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
_enemyController.SetState(EnemyState.Trace);
|
||||
}
|
||||
|
||||
// private IEnumerator AttackSequence()
|
||||
// {
|
||||
// // 1. 전조 이펙트 생성
|
||||
//
|
||||
// // 2. 검을 들어올리는 애니메이션 재생
|
||||
//
|
||||
// // 3. 대기(전조와 검 들어올리는 애니메이션을 위함)
|
||||
//
|
||||
// // 4. 전조 제거
|
||||
//
|
||||
// // 회전 초기화
|
||||
//
|
||||
// // 5. 검 휘두르기
|
||||
//
|
||||
// // 6. 공격 판정 발생
|
||||
//
|
||||
// // 7. 상태 전환
|
||||
// }
|
||||
private IEnumerator AttackSequence()
|
||||
{
|
||||
// 1. 전조 이펙트 생성
|
||||
|
||||
// 2. 검을 들어올림
|
||||
yield return new WaitForSeconds(3f);
|
||||
|
||||
// 3. 대기(전조와 검 들어올리는 애니메이션을 위함)
|
||||
|
||||
// 4. 전조 제거
|
||||
|
||||
// 5. 검 휘두르기
|
||||
_animator.SetTrigger("VertiSlash");
|
||||
|
||||
// 6. 공격 판정 발생
|
||||
|
||||
yield return new WaitForSeconds(1f);
|
||||
// 7. 애니메이션 트리거 종료 -> 애니메이터 상태 머신으로 처리
|
||||
_enemyController.SetState(EnemyState.Trace);
|
||||
}
|
||||
|
||||
public void Exit()
|
||||
{
|
||||
if (_attackRoutine != null)
|
||||
{
|
||||
_enemyController.StopCoroutine(_attackRoutine);
|
||||
_attackRoutine = null;
|
||||
}
|
||||
_animator.SetBool("Attack", false);
|
||||
_animator = null;
|
||||
_enemyController = null;
|
||||
}
|
||||
}
|
@ -15,7 +15,7 @@ public class EnemyStateTrace : IEnemyState
|
||||
{
|
||||
_enemyController = enemyController;
|
||||
|
||||
_detectPlayerTransform = _enemyController.DetectPlayerInCircle();
|
||||
_detectPlayerTransform = _enemyController.TraceTargetTransform;
|
||||
if (!_detectPlayerTransform)
|
||||
{
|
||||
_enemyController.SetState(EnemyState.Idle);
|
||||
|
Loading…
x
Reference in New Issue
Block a user