67 lines
1.0 KiB
C#
67 lines
1.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
[Serializable]
|
|
public class terrain_region_class
|
|
{
|
|
public bool active;
|
|
|
|
public bool foldout;
|
|
|
|
public string text;
|
|
|
|
public List<terrain_area_class> area;
|
|
|
|
public int area_select;
|
|
|
|
public int mode;
|
|
|
|
public Rect area_size;
|
|
|
|
public terrain_region_class()
|
|
{
|
|
active = true;
|
|
foldout = true;
|
|
text = "Terrain Area";
|
|
area = new List<terrain_area_class>();
|
|
area.Add(new terrain_area_class());
|
|
}
|
|
|
|
public virtual void add_area(int index)
|
|
{
|
|
area.Insert(index, new terrain_area_class());
|
|
set_area_index();
|
|
set_area_text();
|
|
area[index].set_terrain_text();
|
|
area[index].path = Application.dataPath;
|
|
}
|
|
|
|
public virtual void erase_area(int index)
|
|
{
|
|
area.RemoveAt(index);
|
|
set_area_index();
|
|
set_area_text();
|
|
}
|
|
|
|
public virtual void set_area_index()
|
|
{
|
|
for (int i = 0; i < area.Count; i++)
|
|
{
|
|
area[i].index = i;
|
|
}
|
|
}
|
|
|
|
public virtual void set_area_text()
|
|
{
|
|
if (area.Count > 1)
|
|
{
|
|
text = "Terrain Areas";
|
|
}
|
|
else
|
|
{
|
|
text = "Terrain Area";
|
|
}
|
|
}
|
|
}
|