コード例 #1
0
        public GeoClipMapLayer(Game game, short n, string terrainAsset)
            : base(game)
        {
            TerrainMap = terrainAsset;

            short m = (short)((n + 1) / 4);
            short edge = (short)((m * 2) - 1);

            for (int b = 0; b < blocks.Length; b++)
            {
                blocks[b] = new GeoClipMapFootPrintBlock(game, m);

                switch (b)
                {
                    case 0:
                        blocks[b].Position = new Vector3(-edge, 0, -edge);
                        blocks[b].BlockType = BlockTypes.TopLeft;
                        break;
                    case 1:
                        blocks[b].Position = new Vector3(-m, 0, -edge);
                        blocks[b].BlockType = BlockTypes.Top;
                        break;
                    case 2:
                        blocks[b].Position = new Vector3(1, 0, -edge);
                        blocks[b].BlockType = BlockTypes.Top;
                        break;
                    case 3:
                        blocks[b].Position = new Vector3(m, 0, -edge);
                        blocks[b].BlockType = BlockTypes.TopRight;
                        break;
                    case 4:
                        blocks[b].Position = new Vector3(-edge, 0, -m);
                        blocks[b].BlockType = BlockTypes.Left;
                        break;
                    case 5:
                        blocks[b].Position = new Vector3(m, 0, -m);
                        blocks[b].BlockType = BlockTypes.Right;
                        break;
                    case 6:
                        blocks[b].Position = new Vector3(-edge, 0, 1);
                        blocks[b].BlockType = BlockTypes.Left;
                        break;
                    case 7:
                        blocks[b].Position = new Vector3(m, 0, 1);
                        blocks[b].BlockType = BlockTypes.Right;
                        break;
                    case 8:
                        blocks[b].Position = new Vector3(-edge, 0, m);
                        blocks[b].BlockType = BlockTypes.BottomLeft;
                        break;
                    case 9:
                        blocks[b].Position = new Vector3(-m, 0, m);
                        blocks[b].BlockType = BlockTypes.Bottom;
                        break;
                    case 10:
                        blocks[b].Position = new Vector3(1, 0, m);
                        blocks[b].BlockType = BlockTypes.Bottom;
                        break;
                    case 11:
                        blocks[b].Position = new Vector3(m, 0, m);
                        blocks[b].BlockType = BlockTypes.BottomRight;
                        break;
                }
                blocks[b].Orientation *= Orientation;
            }

            for (int b = 0; b < fixup.Length; b++)
            {
                switch (b)
                {
                    case 0:
                        fixup[b] = new GeoClipMapFootPrintFixUp(game, m, false);
                        fixup[b].Position = new Vector3(-1, 0, -edge);
                        fixup[b].FixUpType = FixUpTypes.Top;
                        break;
                    case 1:
                        fixup[b] = new GeoClipMapFootPrintFixUp(game, m, false);
                        fixup[b].Position = new Vector3(-1, 0, m);
                        fixup[b].FixUpType = FixUpTypes.Bottom;
                        break;
                    case 2:
                        fixup[b] = new GeoClipMapFootPrintFixUp(game, m, true);
                        fixup[b].Position = new Vector3(-edge, 0, -1);
                        fixup[b].FixUpType = FixUpTypes.Left;
                        break;
                    case 3:
                        fixup[b] = new GeoClipMapFootPrintFixUp(game, m, true);
                        fixup[b].Position = new Vector3(m, 0, -1);
                        fixup[b].FixUpType = FixUpTypes.Right;
                        break;
                }
                fixup[b].Orientation *= Orientation;
            }

            for (int b = 0; b < trim.Length; b++)
            {
                switch (b)
                {
                    case 0:
                        trim[b] = new GeoClipMapFootPrintTrim(game, m, false);
                        trim[b].Position = new Vector3(-m, 0, -m);
                        break;
                    case 1:
                        trim[b] = new GeoClipMapFootPrintTrim(game, m, false);
                        trim[b].Position = new Vector3(0, 0, -m);
                        break;
                    case 2:
                        trim[b] = new GeoClipMapFootPrintTrim(game, m, true);
                        trim[b].Position = new Vector3(m - 1, 0, -m);
                        break;
                    case 3:
                        trim[b] = new GeoClipMapFootPrintTrim(game, m, true);
                        trim[b].Position = new Vector3(m - 1, 0, 0);
                        break;
                }
                trim[b].Orientation *= Orientation;
            }
        }
コード例 #2
0
        public GeoClipMapLayer(Game game, short n, string terrainAsset)
            : base(game)
        {
            TerrainMap = terrainAsset;

            short m    = (short)((n + 1) / 4);
            short edge = (short)((m * 2) - 1);

            for (int b = 0; b < blocks.Length; b++)
            {
                blocks[b] = new GeoClipMapFootPrintBlock(game, m);

                switch (b)
                {
                case 0:
                    blocks[b].Position  = new Vector3(-edge, 0, -edge);
                    blocks[b].BlockType = BlockTypes.TopLeft;
                    break;

                case 1:
                    blocks[b].Position  = new Vector3(-m, 0, -edge);
                    blocks[b].BlockType = BlockTypes.Top;
                    break;

                case 2:
                    blocks[b].Position  = new Vector3(1, 0, -edge);
                    blocks[b].BlockType = BlockTypes.Top;
                    break;

                case 3:
                    blocks[b].Position  = new Vector3(m, 0, -edge);
                    blocks[b].BlockType = BlockTypes.TopRight;
                    break;

                case 4:
                    blocks[b].Position  = new Vector3(-edge, 0, -m);
                    blocks[b].BlockType = BlockTypes.Left;
                    break;

                case 5:
                    blocks[b].Position  = new Vector3(m, 0, -m);
                    blocks[b].BlockType = BlockTypes.Right;
                    break;

                case 6:
                    blocks[b].Position  = new Vector3(-edge, 0, 1);
                    blocks[b].BlockType = BlockTypes.Left;
                    break;

                case 7:
                    blocks[b].Position  = new Vector3(m, 0, 1);
                    blocks[b].BlockType = BlockTypes.Right;
                    break;

                case 8:
                    blocks[b].Position  = new Vector3(-edge, 0, m);
                    blocks[b].BlockType = BlockTypes.BottomLeft;
                    break;

                case 9:
                    blocks[b].Position  = new Vector3(-m, 0, m);
                    blocks[b].BlockType = BlockTypes.Bottom;
                    break;

                case 10:
                    blocks[b].Position  = new Vector3(1, 0, m);
                    blocks[b].BlockType = BlockTypes.Bottom;
                    break;

                case 11:
                    blocks[b].Position  = new Vector3(m, 0, m);
                    blocks[b].BlockType = BlockTypes.BottomRight;
                    break;
                }
                blocks[b].Orientation *= Orientation;
            }

            for (int b = 0; b < fixup.Length; b++)
            {
                switch (b)
                {
                case 0:
                    fixup[b]           = new GeoClipMapFootPrintFixUp(game, m, false);
                    fixup[b].Position  = new Vector3(-1, 0, -edge);
                    fixup[b].FixUpType = FixUpTypes.Top;
                    break;

                case 1:
                    fixup[b]           = new GeoClipMapFootPrintFixUp(game, m, false);
                    fixup[b].Position  = new Vector3(-1, 0, m);
                    fixup[b].FixUpType = FixUpTypes.Bottom;
                    break;

                case 2:
                    fixup[b]           = new GeoClipMapFootPrintFixUp(game, m, true);
                    fixup[b].Position  = new Vector3(-edge, 0, -1);
                    fixup[b].FixUpType = FixUpTypes.Left;
                    break;

                case 3:
                    fixup[b]           = new GeoClipMapFootPrintFixUp(game, m, true);
                    fixup[b].Position  = new Vector3(m, 0, -1);
                    fixup[b].FixUpType = FixUpTypes.Right;
                    break;
                }
                fixup[b].Orientation *= Orientation;
            }

            for (int b = 0; b < trim.Length; b++)
            {
                switch (b)
                {
                case 0:
                    trim[b]          = new GeoClipMapFootPrintTrim(game, m, false);
                    trim[b].Position = new Vector3(-m, 0, -m);
                    break;

                case 1:
                    trim[b]          = new GeoClipMapFootPrintTrim(game, m, false);
                    trim[b].Position = new Vector3(0, 0, -m);
                    break;

                case 2:
                    trim[b]          = new GeoClipMapFootPrintTrim(game, m, true);
                    trim[b].Position = new Vector3(m - 1, 0, -m);
                    break;

                case 3:
                    trim[b]          = new GeoClipMapFootPrintTrim(game, m, true);
                    trim[b].Position = new Vector3(m - 1, 0, 0);
                    break;
                }
                trim[b].Orientation *= Orientation;
            }
        }