private static Bitmap DrawProgressCircular(Bitmap original, int steps, int finished)
        {
            int[] buffer = new int[original.Width * original.Height];
            original.GetPixels(buffer, 0, original.Width, 0, 0, original.Width, original.Height);

            for (int y = 0; y < original.Height; y++)
            {
                for (int x = 0; x < original.Width; x++)
                {
                    Color pixel = new Color(buffer[x + y * original.Width]);

                    var p = CoordConvertor.ToPolar(
                        x - original.Width / 2, original.Height / 2 - y);
                    if ((p.Angle > 0 ? p.Angle : Math.PI * 2 + p.Angle) > Math.PI * 2 / steps * finished)
                    {
                        int greyscale = (int)(pixel.R * 0.3 + pixel.G * 0.59 + pixel.B * 0.11);
                        var newColor  = new Color(greyscale, greyscale, greyscale, pixel.A);
                        buffer[x + y * original.Width] = newColor.ToArgb();
                    }
                    else
                    {
                        buffer[x + y * original.Width] = pixel.ToArgb();
                    }
                }
            }

            var result = Bitmap.CreateBitmap(original.Width, original.Height, Bitmap.Config.Argb8888);

            result.SetPixels(buffer, 0, original.Width, 0, 0, original.Width, original.Height);

            return(result);
        }
Exemple #2
0
    private void Start()
    {
        ChunksController = new ChunksController();
        VoxelController  = new VoxelController();

        WorldData = SaveSystem.LoadWorld("test_world");

        Vector3 spawnPosition = new Vector3(
            Settings.Get.WorldCentre,
            //Settings.Get.ChunkHeight / 2 - 50,
            TerrainAttributes.solidGroundHeight + 10,
            Settings.Get.WorldCentre);

        Player.transform.position = spawnPosition;
        playerLastCoord           = CoordConvertor.GetChunkCoord(Player.transform.position);

        LoadWorld();

        GenerateWorld();
    }
Exemple #3
0
    void Update()
    {
        PlayerCoord = CoordConvertor.GetChunkCoord(Player.transform.position);

        if (!PlayerCoord.Equals(playerLastCoord))
        {
            playerLastCoord = PlayerCoord;
            ChunksController.CheckViewDistance(PlayerCoord);
        }

        ChunksController.CreateNextChunk();

        if (Input.GetKeyDown(KeyCode.F3))
        {
            DebugScreen.gameObject.SetActive(!DebugScreen.gameObject.activeSelf);
        }

        if (Input.GetKeyDown(KeyCode.F1))
        {
            SaveSystem.SaveWorld(WorldData);
        }
    }
    public Chunk GetChunk(Vector3 pPos)
    {
        Vector3Int coord = CoordConvertor.GetChunkCoord(pPos);

        return(chunks[coord.x, coord.z]);
    }