示例#1
0
        /// <summary>
        /// Updates the "Stack Preview" panel for the specified <see cref="EntityCategory"/>.
        /// </summary>
        /// <param name="category">
        /// An <see cref="EntityCategory"/> value indicating the entity stack to preview.</param>
        /// <exception cref="InvalidEnumArgumentException">
        /// <paramref name="category"/> is <see cref="EntityCategory.Upgrade"/> or an invalid <see
        /// cref="EntityCategory"/> value.</exception>
        /// <remarks>
        /// <b>UpdatePreview</b> shows overlaid images for all entities if <paramref
        /// name="category"/> equals <b>Effect</b> or <b>Terrain</b>, and only the image for the
        /// topmost entity if <paramref name="category"/> equals <b>Unit</b>.</remarks>

        private void UpdatePreview(EntityCategory category)
        {
            switch (category)
            {
            case EntityCategory.Terrain:
                // show entire stack for terrains
                TerrainPreview.Show(this._terrains);
                break;

            case EntityCategory.Unit:
                // show only topmost entity for units
                int index = this._units.Count - 1;
                if (index < 0)
                {
                    EntityPreview.Clear();
                }
                else
                {
                    EntityPreview.Show(this._units[index]);
                }
                break;

            case EntityCategory.Effect:
                // show entire stack for effects
                EntityPreview.Show(this._effects);
                break;

            default:
                ThrowHelper.ThrowInvalidEnumArgumentException(
                    "category", (int)category, typeof(EntityCategory));
                break;
            }
        }
示例#2
0
 private void LoadTreeBrush()
 {
     if (currentTreeBrush == null)
     {
         currentTreeBrush = new TreeBrush();
     }
     previewMesh = new TerrainPreview();
     if (((TerrainScript)target).treePrototypes.Count > 0)
     {
         previewMesh.CreatePreviewmesh(((TerrainScript)target).treePrototypes[currentSelectedPrototype].prefab);
     }
 }
    public override void OnInspectorGUI()
    {
        TerrainPreview mapPreview = (TerrainPreview)target;

        if (DrawDefaultInspector())
        {
            if (mapPreview.autoUpdate)
            {
                mapPreview.DrawMapInEditor();
            }
        }

        if (GUILayout.Button("Generate"))
        {
            mapPreview.DrawMapInEditor();
        }
    }
示例#4
0
 private void LoadTreeBrush()
 {
     if (currentTreeBrush == null) {
         currentTreeBrush = new TreeBrush();
     }
     previewMesh = new TerrainPreview();
     if (((TerrainScript)target).treePrototypes.Count > 0)
         previewMesh.CreatePreviewmesh( ((TerrainScript)target).treePrototypes[currentSelectedPrototype].prefab );
 }
示例#5
0
 private void OnEnable()
 {
     Terrain = (TerrainPreview)target;
 }