public void SetBuildingData(BuildingInfoBean itemData)
    {
        GameObject objBuilding = GameObject.Find("Building");
        GameObject objModel    = GameObject.Find("Model");

        CptUtil.RemoveChildsByActiveInEditor(objBuilding);
        List <BuildingBean> listData = itemData.listBuildingData;

        if (listData == null)
        {
            return;
        }
        for (int i = 0; i < listData.Count; i++)
        {
            BuildingBean buildingData = listData[i];
            GameObject   objItem      = Instantiate(objModel);
            objItem.SetActive(true);
            objItem.transform.SetParent(objBuilding.transform);

            BuildingEditor buildingEditor = objItem.GetComponent <BuildingEditor>();
            buildingEditor.direction          = (DirectionEnum)buildingData.direction;
            buildingEditor.blockType          = (BlockTypeEnum)buildingData.blockId;
            buildingEditor.randomRate         = buildingData.randomRate;
            buildingEditor.transform.position = buildingData.GetPosition();
            buildingEditor.OnValidate();
        }
    }
    /// <summary>
    ///  展示NPC
    /// </summary>
    public static GameObject ShowNpc(GameObject objNpcContainer, GameObject objNpcModel, CharacterBean characterData)
    {
        CptUtil.RemoveChildsByActiveInEditor(objNpcContainer);
        GameObject objNpc = GameObject.Instantiate(objNpcModel, objNpcContainer.transform);

        objNpc.SetActive(true);
        objNpc.transform.position = new Vector3(characterData.npcInfoData.position_x, characterData.npcInfoData.position_y);

        BaseNpcAI baseNpcAI = objNpc.GetComponent <BaseNpcAI>();

        baseNpcAI.Awake();

        CharacterDressCpt characterDress = CptUtil.GetCptInChildrenByName <CharacterDressCpt>(baseNpcAI.gameObject, "Body");

        characterDress.Awake();

        baseNpcAI.SetCharacterData(characterData);
        return(objNpc);
    }
 private void OnDestroy()
 {
     CptUtil.RemoveChildsByActiveInEditor(mObjNpcContainer);
 }