add floorplan 2.0 package

This commit is contained in:
Vova
2023-10-06 10:09:30 +03:00
parent b791681d51
commit c2bb35a46d
129 changed files with 9157 additions and 8 deletions
@@ -0,0 +1,47 @@
using System.Collections;
using UnityEditor;
using UnityEngine;
using alexism.Floorplan.Core.Components;
using alexism.Floorplan.Core.Enums;
using System;
using System.Collections.Generic;
namespace alexism.Floorplan.Core.editor
{
[CustomEditor(typeof(floorplanComponent))]
public class floorplanComponentEditor : Editor
{
floorplanComponent script;
public void OnEnable()
{
}
void TileTypeChange(object newTileType)
{
script.ChangeComponentType((GameObject)newTileType);
}
public override void OnInspectorGUI()
{
//DrawDefaultInspector();
script = (floorplanComponent)target;
if (EditorGUILayout.DropdownButton(new GUIContent("Tile type"), FocusType.Passive))
{
GenericMenu menu = new GenericMenu();
foreach (TileTypes tileType in (TileTypes[])Enum.GetValues(typeof(TileTypes)))
{
if (tileType == TileTypes.None)
continue;
Debug.Log(tileType+" "+script.getTilesFromType(tileType));
foreach (GameObject tile in script.getTilesFromType(tileType))
{
menu.AddItem(new GUIContent(tileType.ToString()+"/"+tile.name), false,TileTypeChange,tile);
}
}
menu.ShowAsContext();
}
}
}
}