コード例 #1
0
        private Vector3I CalculateCornerPosition()
        {
            Vector3I posDist = ConnectingPosition2.LocalGridPosition - ConnectingPosition1.LocalGridPosition;

            Debug.Assert(posDist.AbsMin() == 0);

            switch (Base6Directions.GetAxis(ConnectingPosition1.Direction))
            {
            case Base6Directions.Axis.ForwardBackward:
                return(new Vector3I(ConnectingPosition1.LocalGridPosition + new Vector3I(0, 0, posDist.Z)));

            case Base6Directions.Axis.LeftRight:
                return(new Vector3I(ConnectingPosition1.LocalGridPosition + new Vector3I(posDist.X, 0, 0)));

            case Base6Directions.Axis.UpDown:
                return(new Vector3I(ConnectingPosition1.LocalGridPosition + new Vector3I(0, posDist.Y, 0)));
            }

            Debug.Fail("Should not get here");
            return(Vector3I.Zero);
        }