コード例 #1
0
        public void Draw(RenderTarget target, RenderStates states)
        {
            for (int x = 0; x < WORLD_SIZE; x++)
            {
                for (int y = 0; y < WORLD_SIZE; y++)
                {
                    if (chunks[x][y] == null)
                    {
                        continue;
                    }

                    target.Draw(chunks[x][y]);
                }
            }

            foreach (var item in Items.Values)
            {
                double distanceToPlayer = AwesomeGame.Distance(item.Position, AwesomeGame.Player.Position);
                if (distanceToPlayer > Tile.TILE_SIZE * Chunk.CHUNK_SIZE * 0.5f)
                {
                    continue;
                }
                target.Draw(item);
            }
        }
コード例 #2
0
        public static void Main(string[] args)
        {
            String      ipAdress = Console.ReadLine();
            AwesomeGame game     = new AwesomeGame(ipAdress);

            game.Run();
        }
コード例 #3
0
        public Chunk GetClosestChunk()
        {
            Chunk  closestChunk = null;
            double smallestDist = Double.MaxValue;

            for (int i = 0; i < World.WORLD_SIZE; i++)
            {
                for (int j = 0; j < World.WORLD_SIZE; j++)
                {
                    double dist = AwesomeGame.Distance(Position, world.chunks[i][j].Position, world.chunks[i][j].Origin);
                    if (dist < smallestDist)
                    {
                        smallestDist = dist;
                        closestChunk = world.chunks[i][j];
                    }
                }
            }
            return(closestChunk);
        }