Beispiel #1
0
        // ----------------------------------------------------------------------------

        private void TestGrid()
        {
            var rand = new Unity.Mathematics.Random(1337);

            for (int x = -103; x <= 103; x += m_grid.m_granularity)
            {
                for (int y = -103; y <= 103; y += m_grid.m_granularity)
                {
                    float  fx       = rand.NextFloat(0.0f, 0.999f);
                    float  fy       = rand.NextFloat(0.0f, 0.999f);
                    float2 position = new float2(x + fx, y + fy);
                    if (m_grid.TryGetCellCoordinate(position, out int2 cellCoordinate))
                    {
                        Debug.LogFormat("[TestSystem::TestGrid] Grid contains {0} at cell: {1}\n", position.ToStringCompact(), cellCoordinate.ToStringCompact());
                    }
                    else
                    {
                        Debug.LogFormat("[TestSystem::TestGrid] Grid does not contain {0}\n", position.ToStringCompact());
                    }
                }
            }
        }