备份CatanBuilding瘦身独立工程
This commit is contained in:
29
Assets/Scripts/HexGrid/Data/HexBuilding.cs
Normal file
29
Assets/Scripts/HexGrid/Data/HexBuilding.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace HexGrid
|
||||
{
|
||||
public class Condtion{
|
||||
|
||||
};
|
||||
|
||||
|
||||
[System.Serializable]
|
||||
public class HexBuilding
|
||||
{
|
||||
public int zoneId;
|
||||
//public int tileId;
|
||||
public int buildingId;
|
||||
public int level;
|
||||
public string buildingName;
|
||||
// 直接使用的坐标
|
||||
public Vector3 buildingPosition; //
|
||||
public string buildCenterTileId;
|
||||
//TODO:LF 是否使用坐标
|
||||
public Vector2Int buildPosition;
|
||||
public List<Condtion> condtions;
|
||||
public List<string> hasTiles;
|
||||
// public GameObject buildModel;
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/HexGrid/Data/HexBuilding.cs.meta
Normal file
3
Assets/Scripts/HexGrid/Data/HexBuilding.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ae04bca5282b4ac9a1f57f0c3636146c
|
||||
timeCreated: 1757504293
|
||||
19
Assets/Scripts/HexGrid/Data/HexSubZone.cs
Normal file
19
Assets/Scripts/HexGrid/Data/HexSubZone.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace HexGrid
|
||||
{
|
||||
[System.Serializable]
|
||||
public class HexSubZone
|
||||
{
|
||||
//
|
||||
public int zoneId; // 属于哪个zone
|
||||
public int subZoneId;
|
||||
//public List<HexTile> tiles= new ();
|
||||
// 当前包括的地块Id
|
||||
public List<string> tileNames = new();
|
||||
//todo:LF 使用ID 比较好,效率更好一点
|
||||
// public List<int> tileIds = new();
|
||||
//TODO:LF 建筑列表
|
||||
// public List<HexBuilding> buildings = new();
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/HexGrid/Data/HexSubZone.cs.meta
Normal file
3
Assets/Scripts/HexGrid/Data/HexSubZone.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a2c69a061a164687896f45bc691fee8a
|
||||
timeCreated: 1757322216
|
||||
39
Assets/Scripts/HexGrid/Data/HexTile.cs
Normal file
39
Assets/Scripts/HexGrid/Data/HexTile.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
|
||||
|
||||
// 应该移动到Data 中去
|
||||
namespace HexGrid
|
||||
{
|
||||
public enum TileType
|
||||
{
|
||||
None,
|
||||
Grass,
|
||||
Road,
|
||||
Water
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class HexTile
|
||||
{
|
||||
//可变的值
|
||||
//0 未激活 1 可建造 2 已经建造完成
|
||||
public int tileStatus;
|
||||
// 固定的值
|
||||
public int id; // 记录地块的Id,取代字符串,引入HexMath 的时候使用
|
||||
public int zoneId; // 保留 一下zoneId,可以快速找到zone
|
||||
public int subZoneIndex; // 子区域的索引
|
||||
public string zoneName;
|
||||
public string tileOriName; // 块的原始名,
|
||||
public string tileId; // 考虑是坐标合并(x_y) tile_0_0
|
||||
public SerializableVector2Int tileCoords; // 在 Chunk 内的坐标
|
||||
public TileType type;
|
||||
public GameObject visual;
|
||||
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{tileId} -> {tileCoords} {type} -> tileStatus:{tileStatus}";
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/HexGrid/Data/HexTile.cs.meta
Normal file
3
Assets/Scripts/HexGrid/Data/HexTile.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b56b1822990b4b81802eb5e71412a047
|
||||
timeCreated: 1757322316
|
||||
26
Assets/Scripts/HexGrid/Data/HexZone.cs
Normal file
26
Assets/Scripts/HexGrid/Data/HexZone.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
|
||||
namespace HexGrid
|
||||
{
|
||||
|
||||
[System.Serializable]
|
||||
public class HexZone
|
||||
{
|
||||
//
|
||||
public int zoneId;
|
||||
public string zoneName;
|
||||
public bool isUnlocked;
|
||||
// 只渲染边缘即可,暂时保留
|
||||
public GameObject zoneObject; // Prefab / 解锁未建的时候构建一下
|
||||
public List<HexSubZone> subZones = new();
|
||||
public List<HexTile> tiles= new ();
|
||||
|
||||
public HexTile AddTile(HexTile tile)
|
||||
{
|
||||
tiles.Add(tile);
|
||||
return tile;
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/HexGrid/Data/HexZone.cs.meta
Normal file
3
Assets/Scripts/HexGrid/Data/HexZone.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4732739fb4c44dcc89ec4712de280e7e
|
||||
timeCreated: 1757322148
|
||||
33
Assets/Scripts/HexGrid/Data/SerializableVector2Int.cs
Normal file
33
Assets/Scripts/HexGrid/Data/SerializableVector2Int.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using UnityEngine;
|
||||
namespace HexGrid
|
||||
{
|
||||
|
||||
[System.Serializable]
|
||||
public class SerializableVector2Int
|
||||
{
|
||||
public int x;
|
||||
public int y;
|
||||
|
||||
public SerializableVector2Int(int x, int y)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
// 隐式转换,方便使用
|
||||
public static implicit operator Vector2Int(SerializableVector2Int v)
|
||||
{
|
||||
return new Vector2Int(v.x, v.y);
|
||||
}
|
||||
|
||||
public static implicit operator SerializableVector2Int(Vector2Int v)
|
||||
{
|
||||
return new SerializableVector2Int(v.x, v.y);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"({x},{y})";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4b763fe890be432b87f12145969ddd1a
|
||||
timeCreated: 1757939498
|
||||
Reference in New Issue
Block a user