示例#1
0
        private static void OnScriptsReloaded()
        {
            if (Application.isEditor)
            {
                AbstractMap abstractMap = UnityEngine.Object.FindObjectOfType <AbstractMap>();

                if (abstractMap == null)
                {
                    return;
                }

                UnityTile[] unityTiles = abstractMap.GetComponentsInChildren <UnityTile>();

                for (int i = 0; i < unityTiles.Length; i++)
                {
                    UnityEngine.Object.DestroyImmediate(unityTiles[i].gameObject);
                }

                abstractMap.DestroyChildObjects();
                if (EditorApplication.isPlaying)
                {
                    abstractMap.ResetMap();
                    return;
                }
                if (abstractMap.IsEditorPreviewEnabled == true)
                {
                    if (EditorApplication.isPlayingOrWillChangePlaymode)
                    {
                        return;
                    }
                    else
                    {
                        abstractMap.DisableEditorPreview();
                        abstractMap.EnableEditorPreview();
                    }
                }
            }
        }