public NavElement AddSurface(Vector2[] points, Vector2 position, float rotation, float cost, float extraOffset = 0f) { NavElement newSurface = new NavElement(points, position, rotation, extraOffset, this, NavElement.Type.Surface, cost); _Surfaces.Add(newSurface); newSurface.DirtyFlagEnabled += MarkSurfacesDirty; _AreSurfacesDirty = true; return(newSurface); }
public NavElement AddObstacle(Vector2[] points, Vector2 position, float rotation, float extraOffset = 0f) { NavElement newObstacle = new NavElement(points, position, rotation, extraOffset, this, NavElement.Type.Obstacle, 1f); _Obstacles.Add(newObstacle); newObstacle.DirtyFlagEnabled += MarkObstaclesDirty; _AreObstaclesDirty = true; return(newObstacle); }
public NavElement AddSurface(float radius, Vector2 position, float cost, float extraOffset = 0f) { Vector2[] points = GetHexagonPoints(radius); NavElement newSurface = new NavElement(points, position, 0f, extraOffset, this, NavElement.Type.Surface, cost); _Surfaces.Add(newSurface); newSurface.DirtyFlagEnabled += MarkSurfacesDirty; _AreSurfacesDirty = true; return(newSurface); }
public NavElement AddObstacle(float radius, Vector2 position, float extraOffset = 0f) { Vector2[] points = GetHexagonPoints(radius); NavElement newObstacle = new NavElement(points, position, 0f, extraOffset, this, NavElement.Type.Obstacle, 1f); _Obstacles.Add(newObstacle); newObstacle.DirtyFlagEnabled += MarkObstaclesDirty; _AreObstaclesDirty = true; return(newObstacle); }
private void AddElement(NavElement element) { if (element.NavType == NavElement.Type.Obstacle) { Obstacles.Add(element); } else if (element.NavType == NavElement.Type.Surface) { Surfaces.Add(element); } element.elementsGroupId = Id; }
public void RemoveNavElement(NavElement navElement) { if (navElement.NavType == NavElement.Type.Obstacle) { navElement.DirtyFlagEnabled -= MarkObstaclesDirty; _Obstacles.Remove(navElement); } else if (navElement.NavType == NavElement.Type.Surface) { navElement.DirtyFlagEnabled -= MarkSurfacesDirty; _Surfaces.Remove(navElement); } navElement.SetDirtyElementGroup(); InnerUpdate(true); }