Exemple #1
0
        public static void 겟컴포넌트인칠드런_리스트_테스트()
        {
            // Arrange (데이터 정렬)
            GetComponent_ChildrenListTest pComponentTest = new GameObject(nameof(겟컴포넌트인칠드런_리스트_테스트)).AddComponent <GetComponent_ChildrenListTest>();
            Transform pTransformTest = pComponentTest.transform;

            int iRandomCount_1 = Random.Range(3, 6);

            for (int i = 0; i < iRandomCount_1; i++)
            {
                new GameObject("Test").transform.SetParent(pTransformTest);
            }

            int iRandomCount_2 = Random.Range(3, 6);

            for (int i = 0; i < iRandomCount_2; i++)
            {
                new GameObject("Test2").transform.SetParent(pTransformTest);
            }



            // Act (기능 실행)
            GetComponentAttributeHelper.DoUpdate_GetComponentAttribute(pComponentTest);



            // Arrange (확인)
            Assert.AreEqual(pComponentTest.Test_GameObjectArray.Length, iRandomCount_1);
            Assert.AreEqual(pComponentTest.Test_TransformArray.Length, iRandomCount_1);
            Assert.AreEqual(pComponentTest.Test_GameObjectList.Count, iRandomCount_1);
            Assert.AreEqual(pComponentTest.Test_TransformList.Count, iRandomCount_1);
        }
Exemple #2
0
        public static void 조부모클래스의_겟컴포넌트인칠드런_테스트()
        {
            // Arrange (데이터 정렬)
            GetComponentTest_Child pComponentTest = new GameObject(nameof(조부모클래스의_겟컴포넌트인칠드런_테스트)).AddComponent <GetComponentTest_Child>();
            Transform pTransformTest = pComponentTest.transform;

            int iRandomCount_1 = Random.Range(3, 6);

            for (int i = 0; i < iRandomCount_1; i++)
            {
                new GameObject(nameof(GetComponentTestTarget_1)).AddComponent <GetComponentTestTarget_1>().transform.SetParent(pTransformTest);
            }

            int iRandomCount_2 = Random.Range(3, 6);

            for (int i = 0; i < iRandomCount_2; i++)
            {
                new GameObject(nameof(GetComponentTestTarget_2)).AddComponent <GetComponentTestTarget_2>().transform.SetParent(pTransformTest);
            }



            // Act (기능 실행)
            GetComponentAttributeHelper.DoUpdate_GetComponentAttribute(pComponentTest);



            // Arrange (확인)
            Assert.AreEqual(pComponentTest.arrTest_1.Length, iRandomCount_1);
            Assert.AreEqual(pComponentTest.arrTest_2.Length, iRandomCount_2);
        }
        public static void GetComponentChildren_Field_Test()
        {
            GameObject pObjectParents = new GameObject(nameof(GetComponentChildren_Field_Test));

            // GetComponent 대상인 자식 추가
            int iChildCount = (int)ETestChildObject.MAX;

            for (int i = 0; i < iChildCount; i++)
            {
                GameObject pObjectChild = new GameObject(((ETestChildObject)i).ToString());
                pObjectChild.transform.SetParent(pObjectParents.transform);
                pObjectChild.AddComponent <Test_ComponentChild_ForPerformance>();
            }

            const int iTestDummy = 50000;

            for (int i = 0; i < iTestDummy; i++)
            {
                GameObject pObjectChild = new GameObject(i.ToString());
                pObjectChild.transform.SetParent(pObjectParents.transform);
                pObjectChild.AddComponent <Test_ComponentChild_ForPerformance>();
            }


            // 자식을 전부 추가한 뒤에 페런츠에 추가한다.
            GetComponentAttribute_PerformanceTest pParents = pObjectParents.AddComponent <GetComponentAttribute_PerformanceTest>();

            GetComponentAttributeHelper.DoUpdate_GetComponentAttribute(pParents);

            Check_Dictionary(pParents.p_mapTest_KeyIsEnum, iChildCount);
            Check_Dictionary(pParents.p_mapTransform_KeyIsEnum, iChildCount);
            Check_Dictionary(pParents.p_mapGameObject_KeyIsEnum, iChildCount);


            Assert.NotNull(pParents.p_pChildComponent_FindEnum);
            Assert.NotNull(pParents.p_pChildComponent_FindString);

            Assert.NotNull(pParents.p_pObject_FindString);
            Assert.NotNull(pParents.p_pObject_FindEnum);
        }
Exemple #4
0
 public void Awake()
 {
     GetComponentAttributeHelper.DoUpdate_GetComponentAttribute(this);
 }
Exemple #5
0
        public static void 겟컴포넌트인칠드런_딕셔너리_리스트_테스트()
        {
            // Arrange (데이터 정렬)
            GetComponent_ChildrenDictionaryListTest pComponentTest = new GameObject(nameof(겟컴포넌트인칠드런_딕셔너리_리스트_테스트)).AddComponent <GetComponent_ChildrenDictionaryListTest>();
            Transform pTransformTest = pComponentTest.transform;

            int iRandomCount_1 = Random.Range(3, 6);

            for (int i = 0; i < iRandomCount_1; i++)
            {
                new GameObject(nameof(GetComponent_ChildrenDictionaryListTest.EChildObjectName.Child1)).transform.SetParent(pTransformTest);
            }

            int iRandomCount_2 = Random.Range(3, 6);

            for (int i = 0; i < iRandomCount_2; i++)
            {
                new GameObject(nameof(GetComponent_ChildrenDictionaryListTest.EChildObjectName.Child2)).transform.SetParent(pTransformTest);
            }



            // Act (기능 실행)
            GetComponentAttributeHelper.DoUpdate_GetComponentAttribute(pComponentTest);



            // Arrange (확인)
            Assert.AreEqual(
                pComponentTest.Test_KeyIs_String_ValueIs_GameObjectArray[nameof(GetComponent_ChildrenDictionaryListTest.EChildObjectName.Child1)].Length,
                iRandomCount_1);

            Assert.AreEqual(
                pComponentTest.Test_KeyIs_String_ValueIs_GameObjectArray[nameof(GetComponent_ChildrenDictionaryListTest.EChildObjectName.Child2)].Length,
                iRandomCount_2);

            Assert.AreEqual(
                pComponentTest.Test_KeyIs_String_ValueIs_GameObjectList[nameof(GetComponent_ChildrenDictionaryListTest.EChildObjectName.Child1)].Count,
                iRandomCount_1);

            Assert.AreEqual(
                pComponentTest.Test_KeyIs_String_ValueIs_GameObjectList[nameof(GetComponent_ChildrenDictionaryListTest.EChildObjectName.Child2)].Count,
                iRandomCount_2);



            Assert.AreEqual(
                pComponentTest.Test_KeyIs_Enum_ValueIs_GameObjectArray[GetComponent_ChildrenDictionaryListTest.EChildObjectName.Child1].Length,
                iRandomCount_1);

            Assert.AreEqual(
                pComponentTest.Test_KeyIs_Enum_ValueIs_GameObjectArray[GetComponent_ChildrenDictionaryListTest.EChildObjectName.Child2].Length,
                iRandomCount_2);

            Assert.AreEqual(
                pComponentTest.Test_KeyIs_Enum_ValueIs_GameObjectList[GetComponent_ChildrenDictionaryListTest.EChildObjectName.Child1].Count,
                iRandomCount_1);

            Assert.AreEqual(
                pComponentTest.Test_KeyIs_Enum_ValueIs_GameObjectList[GetComponent_ChildrenDictionaryListTest.EChildObjectName.Child2].Count,
                iRandomCount_2);
        }
Exemple #6
0
 public override object GetComponent(MonoBehaviour pMono, Type pElementType)
 {
     return(GetComponentAttributeHelper.Event_GetComponentInParents(pMono, pElementType));
 }
Exemple #7
0
 public override object GetComponent(MonoBehaviour pMono, Type pElementType)
 {
     return(GetComponentAttributeHelper.Event_GetComponentInChildren(pMono, pElementType, bInclude_OnDisable, bSearch_By_ComponentName, strComponentName));
 }