Example #1
0
    public static void DrawEntityGrid(Entity entity)
    {
        if (entity == null)
            return;

        Vector3 pos1 = new Vector3();
        Vector3 pos2 = new Vector3();
        Vector3 pos3 = new Vector3();
        Vector3 pos4 = new Vector3();
        pos1.y = pos2.y = pos3.y = pos4.y = 0.5f;
        float gridSize = World.GetInstance().gridSize;
        List<GridPos> list = World.GetInstance().GetGrids(entity.obj.transform.position.x, entity.obj.transform.position.z, entity.GetData().range);
        foreach ( GridPos gridPos in list)
        {
            Vector2 pos = World.GetInstance().GetGridCenter(gridPos);
            pos1.x = pos4.x = pos.x - gridSize * 0.5f;
            pos1.z = pos3.z = pos.y - gridSize * 0.5f;
            pos2.x = pos3.x = pos.x + gridSize * 0.5f;
            pos2.z = pos4.z = pos.y + gridSize * 0.5f;
            DrawLine(pos1, pos2, Color.black);
            DrawLine(pos3, pos4, Color.black);
        }
    }
Example #2
0
 public void RemoveEntity(Entity entity)
 {
     entityList[(int)entity.GetData().type].Remove(entity);
     dirty = true;
 }
Example #3
0
 public void AddEntity(Entity entity)
 {
     entityList[(int)entity.GetData().type].Add(entity);
     dirty = true;
 }