summaryrefslogtreecommitdiff
path: root/WorldlineKeepers/Assets/Scripts/Battle/GridMap.cs
diff options
context:
space:
mode:
authorchai <215380520@qq.com>2023-05-12 10:32:11 +0800
committerchai <215380520@qq.com>2023-05-12 10:32:11 +0800
commit2fc9585797067730f28b03b0727bf05f9deed091 (patch)
tree8807e37b85ba922045eaa17ac445dd0a1d2d730c /WorldlineKeepers/Assets/Scripts/Battle/GridMap.cs
parent2a1cd4fda8a4a8e649910d16b4dfa1ce7ae63543 (diff)
+ worldline keepers
Diffstat (limited to 'WorldlineKeepers/Assets/Scripts/Battle/GridMap.cs')
-rw-r--r--WorldlineKeepers/Assets/Scripts/Battle/GridMap.cs47
1 files changed, 47 insertions, 0 deletions
diff --git a/WorldlineKeepers/Assets/Scripts/Battle/GridMap.cs b/WorldlineKeepers/Assets/Scripts/Battle/GridMap.cs
new file mode 100644
index 0000000..c99bf4a
--- /dev/null
+++ b/WorldlineKeepers/Assets/Scripts/Battle/GridMap.cs
@@ -0,0 +1,47 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+/// <summary>
+/// 用Grid托管需要实现这个接口
+/// </summary>
+public interface IGridMapObject
+{
+ // 坐标,transform.position
+ public Vector2 coordinate { get; }
+}
+
+public class GridCell
+{
+ public List<IGridMapObject> m_Object;
+}
+
+/// <summary>
+/// 用网格划分场景,不依赖形状,只依赖位置
+/// </summary>
+public class GridMap
+{
+
+ // 单个cell的大小
+ private Vector2 m_CellSize;
+
+ // 整个grid的范围 x, y, xcount, ycount
+ private Vector4 m_Range;
+
+ // 左上角开始索引
+ private List<GridCell> m_GridCells;
+
+ public GridMap()
+ {
+ m_GridCells = new List<GridCell>();
+ }
+
+ private int GetGridIndex(Vector2 pos)
+ {
+
+
+ return -1;
+ }
+
+} \ No newline at end of file