public virtual void Render(DrawingHandleWorld handle)
        {
            if (SpriteToDraw == null)
            {
                SetSprite();
            }

            IEnumerable<GridCoordinates> locationcollection;
            switch (pManager.PlacementType)
            {
                case PlacementManager.PlacementTypes.None:
                    locationcollection = SingleCoordinate();
                    break;
                case PlacementManager.PlacementTypes.Line:
                    locationcollection = LineCoordinates();
                    break;
                case PlacementManager.PlacementTypes.Grid:
                    locationcollection = GridCoordinates();
                    break;
                default:
                    locationcollection = SingleCoordinate();
                    break;
            }

            var size = SpriteToDraw.Size;
            foreach (var coordinate in locationcollection)
            {
                var worldPos = pManager.MapManager.GetGrid(coordinate.GridID).LocalToWorld(coordinate).Position;
                var pos = worldPos - (size/(float)EyeManager.PixelsPerMeter) / 2f;
                var color = IsValidPosition(coordinate) ? ValidPlaceColor : InvalidPlaceColor;
                handle.DrawTexture(SpriteToDraw, pos, color);
            }
        }
Example #2
0
        public virtual void Render(DrawingHandleWorld handle)
        {
            if (SpriteToDraw == null)
            {
                SetSprite();
                DebugTools.AssertNotNull(SpriteToDraw);
            }

            IEnumerable <EntityCoordinates> locationcollection;

            switch (pManager.PlacementType)
            {
            case PlacementManager.PlacementTypes.None:
                locationcollection = SingleCoordinate();
                break;

            case PlacementManager.PlacementTypes.Line:
                locationcollection = LineCoordinates();
                break;

            case PlacementManager.PlacementTypes.Grid:
                locationcollection = GridCoordinates();
                break;

            default:
                locationcollection = SingleCoordinate();
                break;
            }

            var size = SpriteToDraw !.Size;

            foreach (var coordinate in locationcollection)
            {
                var worldPos = coordinate.ToMapPos(pManager.EntityManager);
                var pos      = worldPos - (size / (float)EyeManager.PixelsPerMeter) / 2f;
                var color    = IsValidPosition(coordinate) ? ValidPlaceColor : InvalidPlaceColor;
                handle.DrawTexture(SpriteToDraw, pos, color);
            }
        }
Example #3
0
        public virtual void Render(DrawingHandleWorld handle)
        {
            if (SpriteToDraw == null)
            {
                SetSprite();
            }

            IEnumerable <GridCoordinates> locationcollection;

            switch (pManager.PlacementType)
            {
            case PlacementManager.PlacementTypes.None:
                locationcollection = SingleCoordinate();
                break;

            case PlacementManager.PlacementTypes.Line:
                locationcollection = LineCoordinates();
                break;

            case PlacementManager.PlacementTypes.Grid:
                locationcollection = GridCoordinates();
                break;

            default:
                locationcollection = SingleCoordinate();
                break;
            }

            var size = SpriteToDraw.Size;

            foreach (var coordinate in locationcollection)
            {
                var pos   = coordinate.Position - (size / EyeManager.PIXELSPERMETER) / 2f;
                var color = IsValidPosition(coordinate) ? ValidPlaceColor : InvalidPlaceColor;
                handle.DrawTexture(SpriteToDraw, pos, color);
            }
        }