示例#1
0
        /// <summary>
        /// Get the world placement offset of the
        /// </summary>
        public Vector3 getPlacementOffset()
        {
            if (placementSlotType == PlacementSlotTypes.Center)
            {
                return(Vector3.zero);
            }

            // if this is spaced acording to a vertex as opposed to an edge among the 12 options
            bool isAlongVertex = (int)placementSlot % 2 == 0;

            // determine if this is being placed along the inside ring, or border ring of the hexagon.
            float distanceFromCenterOfHex = placementSlotType == PlacementSlotTypes.Border
        ? Universe.HexRadius
        : Universe.HexRadius / 2;

            return(isAlongVertex
        ? Hexagon.VertexLocation(Vector3.zero, Hexagon.GetVertexFromPerimeterSlot(placementSlot), distanceFromCenterOfHex)
        : Hexagon.EdgeCenterLocation(Vector3.zero, Hexagon.GetEdgeFromPerimeterSlot(placementSlot), distanceFromCenterOfHex));
        }