Пример #1
0
    /// <summary>
    /// 获取靠近坐标
    /// </summary>
    public Vector3Int GetClosePositionByDirection(DirectionEnum getDirection, Vector3Int position)
    {
        switch (getDirection)
        {
        case DirectionEnum.UP:
            return(position.AddY(1));

        case DirectionEnum.Down:
            return(position.AddY(-1));

        case DirectionEnum.Left:
            return(position.AddX(-1));

        case DirectionEnum.Right:
            return(position.AddX(1));

        case DirectionEnum.Forward:
            return(position.AddZ(-1));

        case DirectionEnum.Back:
            return(position.AddZ(1));

        default:
            return(position);
        }
    }