Created
December 23, 2019 09:10
-
-
Save IshidaGames/cdc8b128f8704022c7e171816fc09590 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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