21b7da2de9d833aa64b4dcbe58c12a3abe07d8c8c7743a3c2f7d59e6



3cbac737f2d576b660b8f68b12d21a1d0edbb9d8df



using System.Collections;

using System.Collections.Generic;

using UnityEngine;




public class Shooting : MonoBehaviour


{


ย  ย  public float shootSpeed, shootTimer;ย  ย  ย  ย ย 

ย  ย  public Animator animator;

ย  ย  public Transform firePoint;

ย  ย  public GameObject bullet;


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


ย  ย  void Start()


ย  ย  {

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

ย  ย  }



ย  ย  // Update is called once per frame


ย  ย  void Update()


ย  ย  {

ย  ย  ย  ย  if (Input.GetButtonDown("Fire1"))

ย  ย  ย  ย  {

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

ย  ย  ย  ย  ย  ย  bullet.gameObject.SetActive(true);

ย  ย  ย  ย  ย  ย  Shoot();



ย  ย  ย  ย  }

ย  ย  ย  ย  else if (Input.GetButtonUp("Fire1"))


ย  ย  ย  ย  {


ย  ย  ย  ย  ย  ย  animator.SetBool("Shooting", false);

ย  ย  ย  ย  ย  ย  bullet.gameObject.SetActive(false);

ย  ย  ย  ย  ย  ย  Destroy(GameObject.FindWithTag("Weapon"));


ย  ย  ย  ย  }



ย  ย  }



ย  ย  void Shoot()


ย  ย  {ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย ย 

ย  ย  ย  ย  Instantiate(bullet, firePoint.position, firePoint.rotation);ย  ย  ย  ย  ย  ย  ย 


ย  ย  }


}






์™œ์ž๊พธ์‹œ๋ถ€๋ ˆ ๋’ค์—์„œ์ ๊นŒ์š”? ใ… ใ