Esempio n. 1
0
    public void TestDeepCopy()
    {
        _slots.Add(_i1);

        // Make sure shallow copy is the same
        InventorySlots shallowCopy = _slots;

        Assert.AreSame(_slots, shallowCopy);

        // Make sure deep copy is different
        InventorySlots deepCopy = _slots.DeepCopy();

        Assert.AreNotSame(_slots, deepCopy);
    }
Esempio n. 2
0
 /// <summary>
 /// Returns a deep copied instance.
 /// </summary>
 /// <returns>The copy.</returns>
 public UnitData DeepCopy()
 {
     return(new UnitData(ResRef, FirstName, LastName, Class, Portrait, MovementSound, Sprite, Type, AttributeCollection.DeepCopy(), InventorySlots.DeepCopy(), AbilityCollection.DeepCopy()));
 }