编辑器
This commit is contained in:
@@ -14,10 +14,10 @@ public partial class MapManager : MonoBehaviour
|
||||
public event Action onMapCreated;
|
||||
|
||||
public CellType cellType;
|
||||
public Map GenerateMap(int mapid, float width, float height, float sideWidth, float sideHeight)
|
||||
public Map GenerateMap(int mapid, int horizontalNumber, int verticalNumber, float sideWidth, float sideHeight)
|
||||
{
|
||||
ClearMapGrid();
|
||||
map = new Map(width, height, sideWidth, sideHeight);
|
||||
map = new Map(horizontalNumber, verticalNumber, sideWidth, sideHeight);
|
||||
map.SetMapId(mapid);
|
||||
//默认设置半透明0.3
|
||||
map.ChangeGridAlpha(0.25f);
|
||||
@@ -128,11 +128,15 @@ public partial class Map
|
||||
public float height { get; private set; }
|
||||
public float sideWidth { get; private set; }
|
||||
public float sideHeight { get; private set; }
|
||||
public int horizontalNumber { get; private set; }
|
||||
public int verticalNumber { get; private set; }
|
||||
|
||||
public Map(float width, float height, float sideWidth,float sideHeight)
|
||||
public Map(int horizontalNumber, int verticalNumber, float sideWidth,float sideHeight)
|
||||
{
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.horizontalNumber = horizontalNumber;
|
||||
this.verticalNumber = verticalNumber;
|
||||
this.width = horizontalNumber * sideWidth;
|
||||
this.height = verticalNumber * sideHeight;
|
||||
this.sideWidth = sideWidth;
|
||||
this.sideHeight = sideHeight;
|
||||
mapGrid = CreateMapGrid();
|
||||
@@ -216,7 +220,7 @@ public partial class Map
|
||||
int verticalNumber = br.ReadInt32();
|
||||
float sideWidth = br.ReadInt32() / 100f; // 读取时直接除以 100
|
||||
float sideHeight = br.ReadInt32() / 100f; // 读取时直接除以 100
|
||||
var map = MapManager.Instance.GenerateMap(mapId,horizontalNumber * sideWidth, verticalNumber * sideHeight, sideWidth, sideHeight);
|
||||
var map = MapManager.Instance.GenerateMap(mapId,horizontalNumber, verticalNumber, sideWidth, sideHeight);
|
||||
GridSelector.RenderData[] data = map.selector.GetGridData();
|
||||
for (int i = 0; i < horizontalNumber * verticalNumber; i++) {
|
||||
data[i].barrier = br.ReadInt32();
|
||||
|
||||
Reference in New Issue
Block a user