engine/gamesys/src/gamesys/test/test_gamesys.cpp
// Test that go.delete() does not influence other sprite animations in progress
Test that go.delete() does not influence other sprite animations in progress
Test that go . delete () does not influence other sprite animations in progress
TEST_F(SpriteAnimTest, GoDeletion)
{
    dmGameObject::HInstance go1 = Spawn(m_Factory, m_Collection, "/sprite/valid_sprite.goc", dmHashString64("/go1"), 0, 0, Point3(0, 0, 0), Quat(0, 0, 0, 1), Vector3(1, 1, 1));
    dmGameObject::HInstance go2 = Spawn(m_Factory, m_Collection, "/sprite/valid_sprite.goc", dmHashString64("/go2"), 0, 0, Point3(0, 0, 0), Quat(0, 0, 0, 1), Vector3(1, 1, 1));
    dmGameObject::HInstance go3 = Spawn(m_Factory, m_Collection, "/sprite/valid_sprite.goc", dmHashString64("/go3"), 0, 0, Point3(0, 0, 0), Quat(0, 0, 0, 1), Vector3(1, 1, 1));
    ASSERT_NE((void*)0, go1);
    ASSERT_NE((void*)0, go2);
    ASSERT_NE((void*)0, go3);
    dmGameObject::HInstance go_animater = Spawn(m_Factory, m_Collection, "/sprite/sprite_anim.goc", dmHashString64("/go_animater"), 0, 0, Point3(0, 0, 0), Quat(0, 0, 0, 1), Vector3(1, 1, 1));
    ASSERT_NE((void*)0, go_animater);
    ASSERT_TRUE(dmGameObject::Update(m_Collection, &m_UpdateContext));
    ASSERT_TRUE(dmGameObject::PostUpdate(m_Collection));
    ASSERT_TRUE(dmGameObject::Update(m_Collection, &m_UpdateContext));
    ASSERT_TRUE(dmGameObject::PostUpdate(m_Collection));
    ASSERT_TRUE(dmGameObject::Update(m_Collection, &m_UpdateContext));
    ASSERT_TRUE(dmGameObject::PostUpdate(m_Collection));
    ASSERT_TRUE(dmGameObject::Update(m_Collection, &m_UpdateContext));
    ASSERT_TRUE(dmGameObject::PostUpdate(m_Collection));
    ASSERT_TRUE(dmGameObject::Final(m_Collection));
}
TEST_F ( SpriteAnimTest , GoDeletion ) { dmGameObject :: HInstance go1 = Spawn ( m_Factory , m_Collection , " " , dmHashString64 ( " " ) , 0 , 0 , Point3 ( 0 , 0 , 0 ) , Quat ( 0 , 0 , 0 , 1 ) , Vector3 ( 1 , 1 , 1 ) ) ; dmGameObject :: HInstance go2 = Spawn ( m_Factory , m_Collection , " " , dmHashString64 ( " " ) , 0 , 0 , Point3 ( 0 , 0 , 0 ) , Quat ( 0 , 0 , 0 , 1 ) , Vector3 ( 1 , 1 , 1 ) ) ; dmGameObject :: HInstance go3 = Spawn ( m_Factory , m_Collection , " " , dmHashString64 ( " " ) , 0 , 0 , Point3 ( 0 , 0 , 0 ) , Quat ( 0 , 0 , 0 , 1 ) , Vector3 ( 1 , 1 , 1 ) ) ; ASSERT_NE ( ( void * ) 0 , go1 ) ; ASSERT_NE ( ( void * ) 0 , go2 ) ; ASSERT_NE ( ( void * ) 0 , go3 ) ; dmGameObject :: HInstance go_animater = Spawn ( m_Factory , m_Collection , " " , dmHashString64 ( " " ) , 0 , 0 , Point3 ( 0 , 0 , 0 ) , Quat ( 0 , 0 , 0 , 1 ) , Vector3 ( 1 , 1 , 1 ) ) ; ASSERT_NE ( ( void * ) 0 , go_animater ) ; ASSERT_TRUE ( dmGameObject :: Update ( m_Collection , & m_UpdateContext ) ) ; ASSERT_TRUE ( dmGameObject :: PostUpdate ( m_Collection ) ) ; ASSERT_TRUE ( dmGameObject :: Update ( m_Collection , & m_UpdateContext ) ) ; ASSERT_TRUE ( dmGameObject :: PostUpdate ( m_Collection ) ) ; ASSERT_TRUE ( dmGameObject :: Update ( m_Collection , & m_UpdateContext ) ) ; ASSERT_TRUE ( dmGameObject :: PostUpdate ( m_Collection ) ) ; ASSERT_TRUE ( dmGameObject :: Update ( m_Collection , & m_UpdateContext ) ) ; ASSERT_TRUE ( dmGameObject :: PostUpdate ( m_Collection ) ) ; ASSERT_TRUE ( dmGameObject :: Final ( m_Collection ) ) ; }
Test that go.delete() does not influence other sprite animations in progress
Test that go . delete () does not influence other sprite animations in progress
// Spawn 3 dumy game objects with one sprite in each // Spawn one go with a script that will initiate animations on the above sprites // 1st iteration: //  - go1 animation start // 2nd iteration: //  - go1 animation is over and removed //  - go2+go3 animations start // 3rd iteration: //  - go2 animation is over and removed // 4th iteration: //  - go3 should still be animating (not be influenced by the deletion of go1/go2)