Синтаксис:
Используется csharp
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class StrikeScr : MonoBehaviour
{
public GameObject bullet;
public float delayStr;
public Transform bulStart;
private bool getToStrike = true;
void Start()
{
getToStrike = true;
}
IEnumerator strike()
{
Instantiate(bullet, bulStart.position, transform.rotation);
yield return new WaitForSeconds(delayStr);
getToStrike = true;
}
void Update()
{
if (Input.GetButton("Fire1") == true)
{
if (getToStrike == true)
{
getToStrike = false;
StartCoroutine(strike());
}
}
}
}
using System.Collections.Generic;
using UnityEngine;
public class StrikeScr : MonoBehaviour
{
public GameObject bullet;
public float delayStr;
public Transform bulStart;
private bool getToStrike = true;
void Start()
{
getToStrike = true;
}
IEnumerator strike()
{
Instantiate(bullet, bulStart.position, transform.rotation);
yield return new WaitForSeconds(delayStr);
getToStrike = true;
}
void Update()
{
if (Input.GetButton("Fire1") == true)
{
if (getToStrike == true)
{
getToStrike = false;
StartCoroutine(strike());
}
}
}
}