Commit 9a03787d authored by 18김상언's avatar 18김상언

활쟁이가 활 쏠 떄 플레이어 있는 쪽으로 방향 전환함.

parent 45ddd7ba
...@@ -81,6 +81,27 @@ AnimationClip: ...@@ -81,6 +81,27 @@ AnimationClip:
m_HasMotionFloatCurves: 0 m_HasMotionFloatCurves: 0
m_GenerateMotionCurves: 0 m_GenerateMotionCurves: 0
m_Events: m_Events:
- time: 0.05
functionName: Flip
data:
objectReferenceParameter: {fileID: 0}
floatParameter: 0
intParameter: 0
messageOptions: 0
- time: 0.13333334
functionName: Flip
data:
objectReferenceParameter: {fileID: 0}
floatParameter: 0
intParameter: 0
messageOptions: 0
- time: 0.21666667
functionName: Flip
data:
objectReferenceParameter: {fileID: 0}
floatParameter: 0
intParameter: 0
messageOptions: 0
- time: 0.25 - time: 0.25
functionName: SetTarget functionName: SetTarget
data: data:
...@@ -88,6 +109,13 @@ AnimationClip: ...@@ -88,6 +109,13 @@ AnimationClip:
floatParameter: 0 floatParameter: 0
intParameter: 0 intParameter: 0
messageOptions: 0 messageOptions: 0
- time: 0.56666666
functionName: Flip
data:
objectReferenceParameter: {fileID: 0}
floatParameter: 0
intParameter: 0
messageOptions: 0
- time: 0.8333333 - time: 0.8333333
functionName: ArrowShot functionName: ArrowShot
data: data:
......
...@@ -30,7 +30,6 @@ public class ArcherTrack : StateMachineBehaviour ...@@ -30,7 +30,6 @@ public class ArcherTrack : StateMachineBehaviour
enemy = animator.GetComponent<EnemyGround>(); enemy = animator.GetComponent<EnemyGround>();
player = GameManager.Instance.player; player = GameManager.Instance.player;
trackSpeed = enemy.trackSpeed; trackSpeed = enemy.trackSpeed;
attackRange = enemy.attackRange; attackRange = enemy.attackRange;
...@@ -52,8 +51,8 @@ public class ArcherTrack : StateMachineBehaviour ...@@ -52,8 +51,8 @@ public class ArcherTrack : StateMachineBehaviour
//shotCounter -= Time.deltaTime; //shotCounter -= Time.deltaTime;
if (animator.GetComponent<Enemy>().PlayerDistance < attackRange/* && shotCounter < 0*/) if (animator.GetComponent<Enemy>().PlayerDistance < attackRange/* && shotCounter < 0*/)
{ {
animator.SetTrigger("AttackTrigger"); animator.SetTrigger("AttackTrigger");
// GameManager.Instance.StartCoroutine(WaitforShot()); // GameManager.Instance.StartCoroutine(WaitforShot());
return; return;
} }
......
...@@ -147,11 +147,13 @@ public class EnemyGround : Enemy { ...@@ -147,11 +147,13 @@ public class EnemyGround : Enemy {
public void SetTarget() public void SetTarget()
{ {
target = GameManager.Instance.player; target = GameManager.Instance.player;
Vector2 direction = transform.GetChild(0).position - target.transform.position; Vector2 direction = transform.GetChild(0).position - target.transform.position;
float angle = Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg; float angle = Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg;
Quaternion rotation = Quaternion.AngleAxis(angle, Vector3.forward); Quaternion rotation = Quaternion.AngleAxis(angle, Vector3.forward);
_rotation = rotation; _rotation = rotation;
Flip();
} }
public void ArrowShot() public void ArrowShot()
...@@ -159,4 +161,10 @@ public class EnemyGround : Enemy { ...@@ -159,4 +161,10 @@ public class EnemyGround : Enemy {
GameObject enemy_arrow = Resources.Load<GameObject>("Prefabs/Projectiles/enemy_arrow"); GameObject enemy_arrow = Resources.Load<GameObject>("Prefabs/Projectiles/enemy_arrow");
Instantiate(enemy_arrow, transform.GetChild(0).position, _rotation); Instantiate(enemy_arrow, transform.GetChild(0).position, _rotation);
} }
public void Flip()
{
NumeratedDir trackDir = (transform.GetChild(0).position.x - target.transform.position.x > 0) ? NumeratedDir.Left : NumeratedDir.Right;
ChangeDir_noOption(trackDir);
}
} }
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