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); } }
public void RemoveEntity(Entity entity) { entityList[(int)entity.GetData().type].Remove(entity); dirty = true; }
public void AddEntity(Entity entity) { entityList[(int)entity.GetData().type].Add(entity); dirty = true; }