Skip to content

Instantly share code, notes, and snippets.

@IshidaGames
Created December 23, 2019 09:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IshidaGames/cdc8b128f8704022c7e171816fc09590 to your computer and use it in GitHub Desktop.
Save IshidaGames/cdc8b128f8704022c7e171816fc09590 to your computer and use it in GitHub Desktop.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Generator : MonoBehaviour
{
public GameObject greenMan;
private float time;
private float interval = 1f;
DefeatCount defeatCount;
void Start()
{
defeatCount = GameObject.Find("DefeatCount").GetComponent<DefeatCount>();
}
void Update()
{
time += Time.deltaTime;
if(time > interval)
{
GameObject copy = Instantiate(greenMan, this.transform.position,
Quaternion.identity);
defeatCount.AddMonsterCount();
time = 0;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment