using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Enemy : MonoBehaviour
{
public Transform player;
public GameSystem system;
// Start is called before the first frame update
void Awake()
{
player = GameObject.Find("player").transform;
system = FindObjectOfType<GameSystem>();
system.EnemyCount += 1;
}

// Update is called once per frame
void Update()
{
}
public void TurnEnd_Enemy()
{
if(this.player.position.x > this.transform.position.x)
{
this.transform.Translate(new Vector2(1, 0));
}
else if(this.player.position.x < this.transform.position.x)
{
this.transform.Translate(new Vector2(-1, 0));
}
if(this.player.position.y > this.transform.position.y)
{
this.transform.Translate(new Vector2(0, 1));
}
else if(this.player.position.y < this.transform.position.y)
{
this.transform.Translate(new Vector2(0, -1));
}
system.actEmeyCount += 1;
}
}

์œ ๋‹ˆํ‹ฐ ํ„ด์ œ ๊ฒŒ์ž„์„ ๋งŒ๋“ค๊ณ  ์žˆ๋Š” ์ค‘์ž…๋‹ˆ๋‹ค.


์œ ๋‹ˆํ‹ฐ๋ฅผ ์ด์šฉํ•ด ํ„ด์ด ๋๋‚  ๋•Œ๋งˆ๋‹ค ์ ์ด ํ”Œ๋ ˆ์ด์–ด๋ฅผ ํ–ฅํ•ด ํ•œ์นธ์”ฉ ์ „์ง„ํ•˜๋Š” ์Šคํฌ๋ฆฝํŠธ๋ฅผ ๋งŒ๋“ค์—ˆ์Šต๋‹ˆ๋‹ค.


๊ทธ๋Ÿฐ๋ฐ ์  ์˜ค๋ธŒ์ ํŠธ๋ฅผ ํ”„๋ฆฌํŽฉ์œผ๋กœ ๋งŒ๋“ค์–ด ์ธ์Šคํ„ด์Šคํ™” ์‹œํ‚ค๋‹ˆ TurnEnd ํ•จ์ˆ˜๊ฐ€ ์‹คํ–‰๋  ๋•Œ ์ œ๋Œ€๋กœย ์ž‘๋™ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.


๋„๋ฌด์ง€ ์–ด๋””๊ฐ€ ๋ฌธ์ œ์ธ์ง€ ๋ชจ๋ฅด๊ฒ ์–ด์„œ ์งˆ๋ฌธ ๋“œ๋ฆฝ๋‹ˆ๋‹ค...