using System;
using UnityEngine;

public class ReusablePrefabPool : AbstractReusablePool
{
	private static ReusablePrefabPool sInstance = null;
	
	public static ReusablePrefabPool Instance
	{
		get
		{
			if (sInstance == null)
			{
				sInstance = new ReusablePrefabPool(new ReusablePrefabFactory());
			}
			return sInstance;
		}
	}
	
	protected ReusablePrefabPool (AbstractReusableFactory factory) : base(factory) { }
	
	new public ReusablePrefab Acquire(object parameter)
	{
		string name = (string)parameter;
		return (ReusablePrefab)((AbstractReusablePool)this).Acquire(name);
	}
	
	#region implemented abstract members of AbstractReusablePool
	protected override bool IsMatch (IReusable reusable, object filter)
	{
		string name = (string)filter;
		ReusablePrefab r = (ReusablePrefab)reusable;
		
		return r.Value.name == name;
	}
	#endregion
}