public void SetUp()
		{
			this.Player = new Mock<UnitTests.TestPlayer>();
			this.Player.SetupAllProperties();

			this.Description1 = new UnitDescription("Unit1", 100, 1f, 5f, 5f);
			this.Description2 = new UnitDescription("Unit2", 100, 1f, 5f, 5f);

			this.Nation = new Nation("TestNation", "NonExisting", new IUnitDescription[] { this.Description1, this.Description2 });
		}
		public void SetUp()
		{
			this.Player = new Mock<TestPlayer>();
			this.Player.SetupAllProperties();

			this.Description = new UnitDescription("sth", 100, 1f, 5f, 10f);

			this.Unit = new Unit(this.Description, this.Player.Object);
			//this.Unit.Owner = null;
			this.Unit.OnInit();
		}
Пример #3
0
		/// <summary>
		/// Inicjalizuje nową jednostkę.
		/// </summary>
		/// <param name="description">Opis.</param>
		/// <param name="owner">Właściciel.</param>
		public Unit(IUnitDescription description, IPlayer owner)
			: base(string.Format("Unit.{0}.{1}", owner.Name, description.Id))
		{
			if (description == null)
			{
				throw new ArgumentNullException("description");
			}
			else if (owner == null)
			{
				throw new ArgumentNullException("owner");
			}
			this.Description = description;
			this.Owner = owner;
		}
		/// <summary>
		/// Do wywoływania z kodu XAML.
		/// Próbuje dodać jednostkę do kolejki.
		/// </summary>
		/// <param name="playerNo">Numer gracza(1 lub 2).</param>
		/// <param name="unit">Jednostka.</param>
		public void RequestUnit(int playerNo, IUnitDescription unit)
		{
			if (this.RequestUnitHandler == null)
			{
				if (playerNo == 1)
				{
					this.Player1Queue.Request(unit.Id);
				}
				else
				{
					this.Player2Queue.Request(unit.Id);
				}
			}
			else
			{
				this.RequestUnitHandler(unit.Id);
			}
		}
		public UnitRequestToken(IUnitDescription unit, IPlayer owner, bool start)
		{
			if (unit == null)
			{
				throw new ArgumentNullException("unit");
			}
			if (owner == null)
			{
				throw new ArgumentNullException("owner");
			}
			this.Unit = unit;
			this.Owner = owner;
			this.IsPaused = !start;
			this.IsValidToken = true;
			this.IsCompleted = false;

			this._TimeLeft = this.Unit.CreationTime;
		}