當前位置: 首頁>>代碼示例>>C#>>正文


C# Map.GetTileZ方法代碼示例

本文整理匯總了C#中UltimaXNA.Ultima.World.Maps.Map.GetTileZ方法的典型用法代碼示例。如果您正苦於以下問題:C# Map.GetTileZ方法的具體用法?C# Map.GetTileZ怎麽用?C# Map.GetTileZ使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在UltimaXNA.Ultima.World.Maps.Map的用法示例。


在下文中一共展示了Map.GetTileZ方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: updateSurroundingsAndNormals

        private void updateSurroundingsAndNormals(Map map)
        {
            Point origin = new Point(Entity.Position.X, Entity.Position.Y);

            float[] surroundingTilesZ = new float[kSurroundingsIndexes.Length];


            for (int i = 0; i < kSurroundingsIndexes.Length; i++)
                surroundingTilesZ[i] = map.GetTileZ(origin.X + kSurroundingsIndexes[i].X, origin.Y + kSurroundingsIndexes[i].Y);

            m_SurroundingTiles = new Surroundings(
                surroundingTilesZ[7], surroundingTilesZ[3], surroundingTilesZ[6]);

            bool isFlat = m_SurroundingTiles.IsFlat && m_SurroundingTiles.East == Entity.Z;
            if (!isFlat)
            {
                int low = 0, high = 0, sort = 0;
                sort = map.GetAverageZ((int)Entity.Z, (int)m_SurroundingTiles.South, (int)m_SurroundingTiles.East, (int)m_SurroundingTiles.Down, ref low, ref high);
                if (sort != SortZ)
                {
                    SortZ = sort;
                    map.GetMapTile(Entity.Position.X, Entity.Position.Y).ForceSort();
                }
            }

            m_Normals[0] = calculateNormal(
                surroundingTilesZ[2], surroundingTilesZ[3],
                surroundingTilesZ[0], surroundingTilesZ[6]);
            m_Normals[1] = calculateNormal(
                Entity.Z, surroundingTilesZ[4],
                surroundingTilesZ[1], surroundingTilesZ[7]);
            m_Normals[2] = calculateNormal(
                surroundingTilesZ[5], surroundingTilesZ[7],
                Entity.Z, surroundingTilesZ[9]);
            m_Normals[3] = calculateNormal(
                surroundingTilesZ[6], surroundingTilesZ[8],
                surroundingTilesZ[3], surroundingTilesZ[10]);

            updateVertexBuffer();
        }
開發者ID:msx752,項目名稱:UltimaXNA,代碼行數:40,代碼來源:GroundView.cs


注:本文中的UltimaXNA.Ultima.World.Maps.Map.GetTileZ方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。