summaryrefslogtreecommitdiff
path: root/WorldlineKeepers/Assets/Scripts/Battle/GridMap.cs
blob: c99bf4af9a8c7ba081d1fca3e99a29974682e33c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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;
    }

}