using System.Collections; using System.Collections.Generic; using System.Runtime.CompilerServices; using UnityEngine; public class EnemyRangeAttack : MonoBehaviour { [HideInInspector] public GameObject Prefab; [HideInInspector] public Transform spawn; [Header("Время между выстрелами")] public float attackTime; [Header("Галочка, если танк смотрит вправо")] public bool isRight=false; IEnumerator Shoot() { Instantiate(Prefab, spawn.position, Quaternion.identity, this.transform); yield return new WaitForSeconds(attackTime); StartCoroutine(Shoot()); } IEnumerator sturt() { yield return new WaitForSeconds(0.7f); StartCoroutine(Shoot()); } void Start() { StartCoroutine(sturt()); if (isRight == true) { Vector3 scaler = transform.localScale; scaler.x *= -1; transform.localScale = scaler; } } // Update is called once per frame void Update() { } }