Example #1
0
		/// <summary>
		/// Attempts to add the specified unit to the squad.
		/// </summary>
		/// <param name="unit">Unit being added to the squad.</param>
		/// <param name="position">Position within the squad to place the unit.</param>
		/// <returns>
		/// Whether or not the unit was successfully added.
		/// </returns>
		public bool AddUnit(CombatUnit unit, UnitPosition position)
		{
			// Verify that the unit will fit within the squad.
			if((Size + unit.UnitSize) >= MAX_UNITS_PER_SQUAD)
				return false;

			if (!IsPositionValid(unit, position))
				return false;

			UnitData unitData = new UnitData();
			unitData.Unit = unit;//(CombatUnit)Instantiate(unit);
			unitData.Position = position;

			Units.Add(unitData);
			
			return true;
		}