Exemplo n.º 1
0
    public override void OnInspectorGUI()
    {
        serializedObject.Update();

        EditorGUILayout.PropertyField(name_Prop, new GUIContent("name"));
        EditorGUILayout.PropertyField(itemType_Prop);

        ItemObject.ItemType st = (ItemObject.ItemType)itemType_Prop.enumValueIndex;

        switch (st)
        {
        case ItemObject.ItemType.Ball:
            EditorGUILayout.PropertyField(costGems_Prop, new GUIContent("costGems"));
            EditorGUILayout.PropertyField(assetImage_Prop, new GUIContent("assetImage"));
            EditorGUILayout.PropertyField(shopImage_Prop, new GUIContent("shopImage"));

            break;

        case ItemObject.ItemType.Currency:
            EditorGUILayout.PropertyField(amount_Prop, new GUIContent("amount"));
            EditorGUILayout.PropertyField(shopImage_Prop, new GUIContent("shopImage"));

            break;

        case ItemObject.ItemType.Booster:
            EditorGUILayout.PropertyField(amount_Prop, new GUIContent("amount"));
            EditorGUILayout.PropertyField(costGems_Prop, new GUIContent("costGems"));
            EditorGUILayout.PropertyField(shopImage_Prop, new GUIContent("shopImage"));

            break;
        }

        serializedObject.ApplyModifiedProperties();
    }
    public override void OnInspectorGUI()
    {
        serializedObject.Update();
        ItemObject.ItemType itype = (ItemObject.ItemType)itemType.enumValueIndex;
        EditorGUILayout.ObjectField(objectSprite, typeof(Sprite));
        EditorGUILayout.PropertyField(pickUpType);
        EditorGUILayout.PropertyField(itemType);
        switch (itype)
        {
        case ItemObject.ItemType.HEALTH_PICKUP:
            int restoreVal = EditorGUILayout.IntField(new GUIContent("Health Restore", "Amount of health to restore"), healthRestore.intValue);
            healthRestore.intValue = restoreVal;
            break;

        case ItemObject.ItemType.ITEM_PICKUP:
            EditorGUILayout.ObjectField(associatedWeapon);
            break;
        }
        serializedObject.ApplyModifiedProperties();
    }