1
Fork 0
mirror of https://github.com/Steffo99/beat-td.git synced 2024-11-27 01:14:19 +00:00
beat-td/Assets/Scripts/InstantiateEverySeconds.cs

21 lines
442 B
C#
Raw Normal View History

2018-04-22 12:07:55 +00:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class InstantiateEverySeconds : MonoBehaviour {
public GameObject target;
public float period;
private float cooldown = 0;
void Update () {
cooldown -= Time.deltaTime;
if (cooldown <= 0)
{
2018-04-22 16:40:31 +00:00
Instantiate(target, transform.position, transform.rotation);
2018-04-22 12:07:55 +00:00
cooldown = period;
}
}
}