Beispiel #1
0
        public override void InitializeProperties()
        {
            Transform player = UEditorInternal.FindPlayer();

            if (player != null)
            {
                inventory = UEditorInternal.FindComponent <AdvancedInventory>(player);
            }
        }
        /// <summary>
        /// This function is called when the window becomes enabled and active.
        /// </summary>
        public static void OnEnable()
        {
            properties   = new WeaponProperties();
            delay        = new EditorDelay(0.1f);
            toolbarItems = new string[] { "First Person Weapon", "Pickable Weapon" };
            Transform player = UEditorInternal.FindPlayer();

            if (player != null)
            {
                inventory = UEditorInternal.FindComponent <AdvancedInventory>(player);
            }
            additionalComponents = new List <AdditionalComponents>()
            {
                new AdditionalComponents
                {
                    name      = "Crosshair",
                    component = typeof(Crosshair),
                    isActive  = true
                },
                new AdditionalComponents
                {
                    name      = "Camera Zoom",
                    component = typeof(FPCameraZoom),
                    isActive  = true
                }
            };
            additionalComponentsRL = new ReorderableList(additionalComponents, typeof(AdditionalComponents), true, true, false, false)
            {
                drawHeaderCallback = (rect) =>
                {
                    EditorGUI.LabelField(new Rect(rect.x, rect.y + 1, 200, EditorGUIUtility.singleLineHeight), "Additional Components");
                },

                drawElementCallback = (rect, index, isActive, isFocused) =>
                {
                    AdditionalComponents additionalSystem = additionalComponents[index];
                    EditorGUI.LabelField(new Rect(rect.x, rect.y + 2, 100, EditorGUIUtility.singleLineHeight), additionalSystem.name);
                    additionalSystem.isActive   = EditorGUI.Toggle(new Rect(rect.width + 10, rect.y + 2, 30, EditorGUIUtility.singleLineHeight), additionalSystem.isActive);
                    additionalComponents[index] = additionalSystem;
                }
            };
        }
Beispiel #3
0
        public static void OnEnable()
        {
            weaponID = ScriptableObject.CreateInstance <WeaponID>();
            if (weaponID != null)
            {
                weaponID.SetID(WeaponID.GenerateID());
                weaponID.SetDisplayName("Write weapon name here...");
            }
            Transform player = UEditorInternal.FindPlayer();

            if (player != null)
            {
                inventory = UEditorInternal.FindComponent <AdvancedInventory>(player);
            }

            weaponIDs    = UEditorInternal.FindAssetsByType <WeaponID>();
            toolbarItems = new string[2] {
                "New", "List"
            };
        }