Пример #1
0
        void Init(EPMPolyTerrainCreator creator)
        {
            sectionIndex    = 0;
            sectionNames    = new string[7];
            sectionNames[0] = "Road";
            sectionNames[1] = "River";
            sectionNames[2] = "Hill";
            sectionNames[3] = "Mountain";
            sectionNames[4] = "SandGround";
            sectionNames[5] = "SoilGround";
            sectionNames[6] = "Island";
            detailIndexList = new List <int>();
            for (int i = 0; i < sectionNames.Length; i++)
            {
                detailIndexList.Add(0);
            }

            m_creator     = creator;
            scale         = Mathf.Floor(m_creator.g_customData.terrainWidth / 500 * 2) / 2;
            textureHeight = Mathf.RoundToInt(m_creator.g_customData.terrainLength / scale);
            textureWidth  = Mathf.RoundToInt(m_creator.g_customData.terrainWidth / scale);

            int halfWidth  = Mathf.Min(textureWidth / 2 + 100, Screen.currentResolution.width / 2);
            int halfHeight = 350;

            position      = new Rect(Screen.currentResolution.width / 2 - halfWidth, Screen.currentResolution.height / 2 - halfHeight, halfWidth * 2, halfHeight * 2);
            lastPosX      = lastPosY = 0;
            showTexture   = new Texture2D(textureWidth, textureHeight);
            originTexture = new Texture2D(textureWidth, textureHeight);
            ReDrawTexture();
            dirty = false;
        }
Пример #2
0
        public static void CreateWindow(EPMPolyTerrainCreator creator)
        {
            EPMDrawMapWindow window = (EPMDrawMapWindow)GetWindow(typeof(EPMDrawMapWindow));

            window.Init(creator);
            window.Show();
        }
        void Awake()
        {
            m_terrainCreator = GameObject.FindObjectOfType <EPMPolyTerrainCreator>();

            m_terrainCreator.Init();
            m_terrainCreator.ImportData();
            GameObject terrianRoot = m_terrainCreator.CreateTerrain();

            for (int i = 0; i < terrianRoot.transform.childCount; i++)
            {
                terrianRoot.transform.GetChild(i).gameObject.AddComponent <MeshCollider>();
            }
        }
        void Awake()
        {
            m_creator = serializedObject.targetObject as EPMPolyTerrainCreator;
            m_creator.Init();
            sectionStyle = new GUIStyle();
            Texture2D tex = new Texture2D(1, 1);

            tex.SetPixel(0, 0, EditorGUIUtility.isProSkin ? new Color(0.18f, 0.18f, 0.18f) : new Color(0.88f, 0.88f, 0.88f));
            tex.Apply();
            sectionStyle.normal.background = tex;

            m_road       = new GeneratingType("Road");
            m_river      = new GeneratingType("River");
            m_hill       = new GeneratingType("Hill");
            m_mountain   = new GeneratingType("Mountain");
            m_sandGround = new GeneratingType("SandGround");
            m_soilGround = new GeneratingType("SoilGround");
            m_island     = new GeneratingType("Island");
        }