Пример #1
0
        public static void CreateTrigger()
        {
            GameObject     trigger  = CreateSceneObject.Create("Trigger");
            SphereCollider collider = trigger.AddComponent <SphereCollider>();

            collider.isTrigger = true;
            trigger.AddComponent <Trigger>();
        }
Пример #2
0
        public static void CreateGameProfileUI()
        {
            GameObject text = CreateSceneObject.Create("Profile");

            text.AddComponent <GameProfileUI>();

            text.transform.localRotation = Quaternion.identity;
            text.transform.localScale    = Vector3.one;
        }
Пример #3
0
        private T CreateSubObject <T>() where T : MonoBehaviour
        {
            if (PrefabUtility.IsPartOfPrefabAsset(this.trigger.gameObject))
            {
                return(CreatePrefabObject.AddGameObjectToPrefab <T>(
                           this.trigger.gameObject,
                           typeof(T).Name
                           ));
            }

            GameObject asset = CreateSceneObject.Create(typeof(T).Name, false);

            return(asset.AddComponent <T>());
        }
        public static void CreateSliderVariable()
        {
            GameObject canvas   = CreateSceneObject.GetCanvasGameObject();
            GameObject sliderGO = DefaultControls.CreateSlider(CreateSceneObject.GetStandardResources());

            sliderGO.transform.SetParent(canvas.transform, false);

            Slider        slider        = sliderGO.GetComponent <Slider>();
            Graphic       targetGraphic = slider.targetGraphic;
            RectTransform rectFill      = slider.fillRect;
            RectTransform rectHandle    = slider.handleRect;

            DestroyImmediate(slider);
            slider = sliderGO.AddComponent <SliderVectorVariable>();
            slider.targetGraphic       = targetGraphic;
            slider.fillRect            = rectFill;
            slider.handleRect          = rectHandle;
            Selection.activeGameObject = sliderGO;
        }
Пример #5
0
        private void CreateTriggerOption(ReorderableList list, string itemType)
        {
            int itemIndex = list.count;

            list.serializedProperty.InsertArrayElementAtIndex(itemIndex);
            SerializedProperty spNewItem = list.serializedProperty.GetArrayElementAtIndex(itemIndex);

            list.index = itemIndex;

            GameObject asset = CreateSceneObject.Create(itemType, false);

            if (itemType == "Event")
            {
                spNewItem.objectReferenceValue = asset.AddComponent <Event>();
            }
            else if (itemType == "Actions")
            {
                spNewItem.objectReferenceValue = asset.AddComponent <Actions>();
            }
        }
Пример #6
0
        public static void CreateConditions()
        {
            GameObject conditionsAsset = CreateSceneObject.Create("Conditions");

            conditionsAsset.AddComponent <Conditions>();
        }