IEnumerator SpawnObject()
{
while (true)
{
yield return new WaitForSeconds(timeBtwSpawn);
Instantiate(spike, transform.position, Quaternion.identity);
// Мутишь условие что бы остановить корутину например если объектов более 10
}
}
StartCoroutine(SpawnObject());
StartCoroutine(SpawnObject());
private void CameraMove()
{
mouseX = Mathf.Clamp(Input.GetAxis("Mouse X") * mouseSensivity, minAngle, maxAngle);
mouseY = Mathf.Clamp(Input.GetAxis("Mouse Y") * mouseSensivity, minAngle, maxAngle);
transform.Rotate(mouseX * new Vector3(0, 1, 0));
cameraTransform.transform.Rotate(-mouseY * new Vector3(1, 0, 0));
}
NavMeshBuilder.BuildNavMesh();
static void Main(string[] args)
{
string[] array = { "а", "о", "э", "е", "и", "ы", "у", "ё", "ю", "я" };
int vcounter = 0;
string itemStr = Console.ReadLine();
int item = Convert.ToInt32(itemStr);
foreach (var item in array)
{
for(int i = 0; i<array.Leght; i++){
if(тут типа берёшь item == array[i]){
vcounter++;
}
}
Console.WriteLine("Count of vowels: " + vcounter.ToString());
}
}
Metanit.com
[SerializeField] private AudioClip puddle;
[SerializeField] private AudioClip rock;
private AudioSource _audioSource;
void Start(){
_audioSource = GetComponent<AudioSource>();
}
void OnTriggerEnter2D(Collider2D other){
if(other.gameObject.CompareTag("Rock")){
_audioSource.clip = rock;
_audioSource.Play();
}
else if(other.gameObject.CompareTag("Puddle")){
_audioSource.clip = puddle;
_audioSource.Play();
}
}
private void OnTriggerStay2D(Collider2D coll)
{
if (Input.GetKey(KeyCode.Space))
{
if (coll.gameObject.tag == "DO")
{
Destroy(coll.gameObject);
}
}
}