public void SetParentTestHierarchyLoop() { EntityMock mockEntity = new EntityMock(); EntityMock parentEntity = new EntityMock(); parentEntity.SetParent(mockEntity); mockEntity.SetParent(parentEntity); }
public void SetParentTest() { EntityMock mockEntity = new EntityMock(); EntityMock parentEntity = new EntityMock(); mockEntity.SetParent(parentEntity); Assert.AreEqual(parentEntity, mockEntity.parent, "Parent objects are not equal"); }
public void FindChildTest() { EntityMock parentEntity = new EntityMock(); EntityMock childEntity1 = new EntityMock(); EntityMock childEntity2 = new EntityMock(); childEntity1.SetParent(parentEntity); childEntity2.SetParent(parentEntity); EntityMock child = parentEntity.FindChild <EntityMock>(); Assert.AreEqual(child, childEntity1, "Got wrong child object"); }
public void GetParentWorldPosTest() { EntityMock entity = new EntityMock(); EntityMock entity2 = new EntityMock(); entity.SetParent(entity2); Vector2 parentPos = new Vector2(2f, 2f); entity2.transform.SetPosition(parentPos); Vector2 newPos = new Vector2(10f, 10f); entity.transform.SetPosition(newPos); Vector2 expected = new Vector2(2f, 2f); Vector2 actual = entity.transform.GetParentWorldPos(); Assert.AreEqual(expected, actual, "Gauta tėvinės esybės pozicija nesutampa su tokia kokia turi būti"); }
public void SetPositionTestWithParent() { EntityMock entity = new EntityMock(); EntityMock entity2 = new EntityMock(); entity.SetParent(entity2); Vector2 parentPos = new Vector2(2f, 2f); entity2.transform.SetPosition(parentPos); Vector2 newPos = new Vector2(10f, 10f); entity.transform.SetPosition(newPos); Vector2 expected = new Vector2(12f, 12f); Vector2 actual = entity.transform.position; Assert.AreEqual(expected, actual, "Nesutampa norima gauti pozicija su gauta esant tėvinei esybei"); }