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

public class DeckRoom : BaseRoom
{

	public GameObject Cannon;
	public float TimeBetweenShots = 5f;

	private Dictionary<GameObject, bool> cannons;
	private float shotDelay = 0f;
	private bool CannonsFiring = false;

	public DeckRoom ()
	{
		cannons = new Dictionary<GameObject, bool> ();
		//cannons.Add (Cannon, false);
	}

	public bool FireCannon ()
	{
		if (!CannonsFiring) {
			CannonsFiring = true;
			return true;
		} else {
			return false;
		}
	}

	public IEnumerator DoWork ()
	{
		while (CannonsFiring) {
			shotDelay += Time.deltaTime;

			if (shotDelay >= TimeBetweenShots) {
				// Implement combat code.

				shotDelay = 0f;
				CannonsFiring = false;
			}
			yield return new WaitForSeconds (0.1f);
		}
		yield return new WaitForSeconds (0.1f);
	}
}
