using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CoinSpawner : MonoBehaviour {

    public GameObject coin;
    public bool please_spawn;

    // Use this for initialization
    void Start ()
    {
        please_spawn = true;


    }
	
	// Update is called once per frame
	void Update ()
    {
		if(WaveController.enemy_wave == false & please_spawn == true)
        {
            SpawnCoin();
            please_spawn = false;

        }

        if (WaveController.enemy_wave == true & please_spawn == false)
        {
            please_spawn = true;
        }
    }

    void SpawnCoin()
    {
        Instantiate(coin, new Vector2(transform.position.x, transform.position.y), Quaternion.identity);
    }
}
