Commit 9eea22ef authored by 15김민규's avatar 15김민규

거미가 이제 관성을 가짐

parent 9580cf3a
...@@ -61,7 +61,7 @@ GameObject: ...@@ -61,7 +61,7 @@ GameObject:
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 1 m_IsActive: 0
--- !u!1 &1734061800721222 --- !u!1 &1734061800721222
GameObject: GameObject:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
...@@ -157,7 +157,7 @@ Transform: ...@@ -157,7 +157,7 @@ Transform:
m_PrefabInternal: {fileID: 100100000} m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1636491341446076} m_GameObject: {fileID: 1636491341446076}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: -6.88, y: 1.405, z: 0} m_LocalPosition: {x: 11.29, y: -17.94, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: m_Children:
- {fileID: 4015301101001556} - {fileID: 4015301101001556}
...@@ -301,6 +301,8 @@ MonoBehaviour: ...@@ -301,6 +301,8 @@ MonoBehaviour:
- 0.5 - 0.5
MovementLock: 0 MovementLock: 0
attackRange: 1.2 attackRange: 1.2
WallTest:
CliffTest:
--- !u!114 &114173716467154830 --- !u!114 &114173716467154830
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
......
...@@ -4,12 +4,12 @@ using UnityEngine; ...@@ -4,12 +4,12 @@ using UnityEngine;
public class EnemyAirTrack : StateMachineBehaviour { public class EnemyAirTrack : StateMachineBehaviour {
float trackSpeed; float trackSpeed;
float trackRange;
float angle; float angle;
GameObject player; GameObject player;
Transform animatorRoot; Transform animatorRoot;
EnemyAir enemy; EnemyAir enemy;
Vector2 direction; Vector2 direction;
private readonly float interpolateCoeff = 0.05f;
int maxFrame = 10; int maxFrame = 10;
int frameCount; int frameCount;
...@@ -17,10 +17,10 @@ public class EnemyAirTrack : StateMachineBehaviour { ...@@ -17,10 +17,10 @@ public class EnemyAirTrack : StateMachineBehaviour {
override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
animatorRoot = animator.transform.parent; animatorRoot = animator.transform.parent;
enemy = animator.GetComponent<EnemyAir>(); enemy = animator.GetComponent<EnemyAir>();
player = EnemyManager.Instance.Player; player = GameManager.Instance.player;
trackSpeed = enemy.trackSpeed; trackSpeed = enemy.trackSpeed;
frameCount = 0; frameCount = 0;
direction = Vector2.up;
SetDirection(); SetDirection();
} }
...@@ -57,7 +57,8 @@ public class EnemyAirTrack : StateMachineBehaviour { ...@@ -57,7 +57,8 @@ public class EnemyAirTrack : StateMachineBehaviour {
private void SetDirection() private void SetDirection()
{ {
direction = player.transform.position - animatorRoot.position; Vector2 directionToPlayer = (player.transform.position - animatorRoot.position).normalized;
direction = (directionToPlayer * interpolateCoeff + direction * (1 - interpolateCoeff)).normalized;
angle = Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg; angle = Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg;
enemy.ChangeAngleZ_noOption(angle - 90.0f); enemy.ChangeAngleZ_noOption(angle - 90.0f);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment