temka game killer
Мыслитель
(7000)
1 неделю назад
Попробуй сделать так. Введи переменную времени t.
В методе Start() присвой ей ноль t=0;
в методе Update() увеличивай t на единичку t++
и сделай проверку в методе Update()
if (t==10)
{
спавнишь игровые объекты
переменной t присваиваешь 0
}
Тогда игровые объекты будут спавниться не каждый кадр метода
Update а каждый десятый кадр.
Vlad oktУченик (98)
1 неделю назад
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Denerator : MonoBehaviour
{
public GameObject[] potions;
private int t = 0;
Vector3 dictanse = new Vector3 (30,0);
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
t += 1;
if (t == 10)
{
int number = Random.Range(0, potions.Length);
Instantiate(potions[number], transform.position + dictanse, transform.rotation, transform);
dictanse += new Vector3(30, 0);
}
}
}
спавнится всего 1 и все
temka game killerМыслитель (7000)
1 неделю назад
if (t == 10)
{
int number = Random.Range(0, potions.Length);
Instantiate(potions[number], transform.position + dictanse, transform.rotation, transform);
dictanse += new Vector3(30, 0);
t=0;
}
}
}
спавнится всего 1 и все
temka game killerМыслитель (7000)
1 неделю назад
Есть в природе более нормальный способ замедлить спавны игровых объектов. Но я этих методов не знаю. А делаю ват таким образом.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Denerator : MonoBehaviour
{
public GameObject[] potions;
Vector3 dictanse = new Vector3 (30,0);
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
int number = Random.Range(0, potions.Length);
Instantiate(potions[number], transform.position + dictanse, transform.rotation, transform);
dictanse += new Vector3 (30, 0);
}
}