)using System.Collections;

using System.Collections.Generic;

using UnityEngine;


public class Sword_Man : MonoBehaviour

{

ย  ย  // Start is called before the first frame update

ย  ย  Animator animator;

ย  ย  void Start()

ย  ย  {

ย  ย  ย  ย  transform.position = new Vector3(0, 0, 0);

ย  ย  ย  ย  animator = GetComponent<Animator>();

ย  ย  }


ย  ย  // Update is called once per frame

ย  ย  void Update()

ย  ย  {

ย  ย  ย  ย  float h = Input.GetAxis("Horizontal");

ย  ย  ย  ย  if (h > 0)

ย  ย  ย  ย  {

ย  ย  ย  ย  ย  ย  transform.localScale = new Vector3(-1, 1, 1);

ย  ย  ย  ย  ย  ย  animator.SetBool("moving", true);

ย  ย  ย  ย  }

ย  ย  ย  ย  else if (h < 0)

ย  ย  ย  ย  {

ย  ย  ย  ย  ย  ย  transform.localScale = new Vector3(1, 1, 1);

ย  ย  ย  ย  ย  ย  animator.SetBool("moving", true);

ย  ย  ย  ย  }

ย  ย  ย  ย  else animator.SetBool("moving", false);

ย  ย  ย  ย  transform.Translate(new Vector3(h, 0, 0) * Time.deltaTime);

ย  ย  }

}



๊ฐ•์ขŒ(https://hoil2.tistory.com/6?category=857730)์—์„œ ์“ฐ๋Š” ์ฝ”๋“œ ๊ทธ๋Œ€๋กœ ๋”ฐ๋ผ ์ผ๋Š”๋ฐ ์ด ๊ผด์ด ๋‚ฌ์Šต๋‹ˆ๋‹ค, ์‚ด๋ ค์ฃผ์„ธ์š”