Compare commits
No commits in common. "f2a18345899ab9cefc7a225ca480f967ae7c1512" and "456cc8dafbea06dd4a5e3203063056554e60a599" have entirely different histories.
f2a1834589
...
456cc8dafb
BIN
Assets/JYY/Prefabs/Alien Big Blink.prefab
(Stored with Git LFS)
BIN
Assets/JYY/Prefabs/Alien Big Blink.prefab
(Stored with Git LFS)
Binary file not shown.
BIN
Assets/JYY/Prefabs/Bullets/Magic Missaile.prefab
(Stored with Git LFS)
BIN
Assets/JYY/Prefabs/Bullets/Magic Missaile.prefab
(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.
@ -28,7 +28,7 @@ public class VerticalAoeController : AoeControllerBase
|
|||||||
protected override void HitCheck()
|
protected override void HitCheck()
|
||||||
{
|
{
|
||||||
// 박스 판정 (사각형 직선)
|
// 박스 판정 (사각형 직선)
|
||||||
Vector3 halfExtents = new Vector3(_data.radius, 1f, _data.radius * 2f) * 0.5f;
|
Vector3 halfExtents = new Vector3(_data.radius, 1f, _data.radius * 2f);
|
||||||
Collider[] hits = Physics.OverlapBox(transform.position, halfExtents, transform.rotation, _data.targetLayer);
|
Collider[] hits = Physics.OverlapBox(transform.position, halfExtents, transform.rotation, _data.targetLayer);
|
||||||
|
|
||||||
foreach (var hit in hits)
|
foreach (var hit in hits)
|
||||||
@ -47,7 +47,7 @@ public class VerticalAoeController : AoeControllerBase
|
|||||||
|
|
||||||
private void OnDrawGizmosSelected()
|
private void OnDrawGizmosSelected()
|
||||||
{
|
{
|
||||||
Gizmos.color = Color.yellow;
|
Gizmos.color = Color.red;
|
||||||
Vector3 center = transform.position;
|
Vector3 center = transform.position;
|
||||||
Vector3 size = new Vector3(_data.radius, 1f, _data.radius * 2f);
|
Vector3 size = new Vector3(_data.radius, 1f, _data.radius * 2f);
|
||||||
Gizmos.matrix = Matrix4x4.TRS(center, transform.rotation, Vector3.one);
|
Gizmos.matrix = Matrix4x4.TRS(center, transform.rotation, Vector3.one);
|
||||||
|
@ -26,9 +26,6 @@ public class BulletBase : MonoBehaviour
|
|||||||
// 내부용
|
// 내부용
|
||||||
private Vector3 _direction = Vector3.forward;
|
private Vector3 _direction = Vector3.forward;
|
||||||
private float _timer;
|
private float _timer;
|
||||||
private Vector3 _prevPosition;
|
|
||||||
|
|
||||||
[SerializeField] private LayerMask _targetLayer;
|
|
||||||
|
|
||||||
public virtual void Initialize(BulletData bulletData)
|
public virtual void Initialize(BulletData bulletData)
|
||||||
{
|
{
|
||||||
@ -43,41 +40,31 @@ public class BulletBase : MonoBehaviour
|
|||||||
transform.rotation = Quaternion.LookRotation(_direction);
|
transform.rotation = Quaternion.LookRotation(_direction);
|
||||||
|
|
||||||
_timer = 0f;
|
_timer = 0f;
|
||||||
_prevPosition = transform.position;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Update()
|
private void Update()
|
||||||
{
|
{
|
||||||
float moveDist = _speed * Time.deltaTime;
|
// 1) 이동
|
||||||
|
transform.position += _direction * (_speed * Time.deltaTime);
|
||||||
|
|
||||||
// 1) Raycast 충돌 검사
|
// 2) 수명 카운트
|
||||||
if (Physics.Raycast(_prevPosition, _direction, out RaycastHit hit, moveDist, _targetLayer))
|
|
||||||
{
|
|
||||||
// 닿은 지점으로 이동
|
|
||||||
transform.position = hit.point;
|
|
||||||
OnBulletHit(hit);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 2) 실제 이동
|
|
||||||
transform.position += _direction * moveDist;
|
|
||||||
_prevPosition = transform.position;
|
|
||||||
|
|
||||||
// 3) 수명 검사
|
|
||||||
_timer += Time.deltaTime;
|
_timer += Time.deltaTime;
|
||||||
if (_timer >= _lifeTime)
|
if (_timer >= _lifeTime)
|
||||||
|
{
|
||||||
DestroyBullet();
|
DestroyBullet();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnBulletHit(RaycastHit hit)
|
private void OnTriggerEnter(Collider other)
|
||||||
{
|
{
|
||||||
PlayerController playerController = hit.transform.GetComponent<PlayerController>();
|
// TODO: 주인공 캐릭터를 찾는 로직 추가 필요
|
||||||
Debug.Log(hit.transform.name);
|
// 주인공 스크립트를 찾아 처리할 것.
|
||||||
if (playerController != null)
|
var character = other.GetComponent<CharacterBase>();
|
||||||
|
if (character != null)
|
||||||
{
|
{
|
||||||
playerController.TakeDamage(_damage);
|
character.TakeDamage(_damage);
|
||||||
|
DestroyBullet();
|
||||||
}
|
}
|
||||||
DestroyBullet();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void DestroyBullet()
|
protected virtual void DestroyBullet()
|
||||||
|
@ -5,6 +5,8 @@ using Random = UnityEngine.Random;
|
|||||||
|
|
||||||
public class CasterDemonController : EnemyController
|
public class CasterDemonController : EnemyController
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
// Animation
|
// Animation
|
||||||
public static readonly int Cast = Animator.StringToHash("Cast");
|
public static readonly int Cast = Animator.StringToHash("Cast");
|
||||||
public static readonly int Flee = Animator.StringToHash("Flee");
|
public static readonly int Flee = Animator.StringToHash("Flee");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user