﻿using System;
using System.Diagnostics;

namespace RelEnt.Transaction
{
	public class RemoveComponentTransaction : ESTransaction
	{
		public euid e;
		public IComponent c;

		public RemoveComponentTransaction(euid e, IComponent c)
		{
			this.e = e;
			this.c = c;
			Debug.Assert(c != null);
		}

		internal override void ProcessTransaction(EntityManagerSystem man)
		{
			if (e == euid.NULL)
			{
				throw new ArgumentException("Null euid given");
			}
			var compDict = man.components[c.GetType()];
			compDict.Remove(e);
		}
	}
}
