49 lines
1.1 KiB
C#
49 lines
1.1 KiB
C#
using Framework;
|
|
using Newtonsoft.Json;
|
|
using System;
|
|
using Gameplay;
|
|
using PhxhSDK.Phxh;
|
|
using UnityEngine;
|
|
using UnityEngine.Serialization;
|
|
|
|
[Serializable]
|
|
public class MapBlockData
|
|
{
|
|
public int TerrainTypeIndex;
|
|
public MapBlockData()
|
|
{
|
|
TerrainTypeIndex = -1;// -1 means no terrain type
|
|
}
|
|
public bool IsDefaultTerrainType()
|
|
{
|
|
return TerrainTypeIndex == -1;
|
|
}
|
|
|
|
public TerrainTypeProperty GetTerrainTypeProperty()
|
|
{
|
|
var props = TerrainTypeConfig.TerrainTypeProperties;
|
|
if (props != null && TerrainTypeIndex >= 0 && TerrainTypeIndex < props.Count)
|
|
{
|
|
return props[TerrainTypeIndex];
|
|
}
|
|
return TerrainTypeConfig.DefaultTerrainTypeProperty;
|
|
}
|
|
}
|
|
|
|
[Serializable]
|
|
public class TerrainTypeProperty
|
|
{
|
|
public string name;
|
|
public bool selectable;
|
|
[FormerlySerializedAs("canPass")] public bool emptyBlock;
|
|
public bool banAttack;
|
|
public bool banGFX;
|
|
public int crossLevel;
|
|
|
|
[JsonConverter(typeof(ColorJsonConverter))]
|
|
public Color Color;
|
|
}
|
|
|
|
|
|
|