예제 #1
0
        private List <HeightmapHandle> UpdateHoveredHandlesSimpleSelection(RaycastHit raycast)
        {
            GridMesh gridMesh = GameManager.Instance.Map.SurfaceGridMesh;

            List <HeightmapHandle> hoveredHandles = new List <HeightmapHandle>();

            TileSelectionHit hit = TileSelection.PositionToTileSelectionHit(raycast.point, TileSelectionMode.Everything);

            switch (hit.Target)
            {
            case TileSelectionTarget.InnerTile:
                hoveredHandles.Add(gridMesh.GetHandle(hit.X, hit.Y));
                hoveredHandles.Add(gridMesh.GetHandle(hit.X + 1, hit.Y));
                hoveredHandles.Add(gridMesh.GetHandle(hit.X, hit.Y + 1));
                hoveredHandles.Add(gridMesh.GetHandle(hit.X + 1, hit.Y + 1));
                break;

            case TileSelectionTarget.Corner:
                hoveredHandles.Add(gridMesh.GetHandle(hit.X, hit.Y));
                break;

            case TileSelectionTarget.BottomBorder:
                hoveredHandles.Add(gridMesh.GetHandle(hit.X, hit.Y));
                hoveredHandles.Add(gridMesh.GetHandle(hit.X + 1, hit.Y));
                break;

            case TileSelectionTarget.LeftBorder:
                hoveredHandles.Add(gridMesh.GetHandle(hit.X, hit.Y));
                hoveredHandles.Add(gridMesh.GetHandle(hit.X, hit.Y + 1));
                break;
            }

            return(hoveredHandles);
        }