Ejemplo n.º 1
0
    public static void Load(string Path, string MapName, Vector2 coords)
    {
        ThreadWorking = true;
        //float startTime = Time.time;
        long milliseconds = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;

        blockData                     = new BlockDataType();
        blockData.ChunksData          = new List <ChunkData>();
        blockData.terrainTexturePaths = new List <string>();
        blockData.terrainTextures     = new Dictionary <string, Texture2Ddata>();
        blockData.textureFlags        = new Dictionary <string, TerrainTextureFlag>();
        blockData.heightScales        = new Dictionary <string, float>();
        blockData.heightOffsets       = new Dictionary <string, float>();

        ParseADT_Main(Path, MapName, coords);
        ParseADT_Tex(Path, MapName, coords);
        //if (ADTSettings.LoadWMOs || ADTSettings.LoadM2s)
        //ParseADT_Obj(Path, MapName, coords);
        ADT_ProcessData.GenerateMeshArrays();
        if (ADTSettings.LoadShadowMaps)
        {
            ADT_ProcessData.AdjustAlphaBasedOnShadowmap(MapName);
        }
        ADT_ProcessData.Load_hTextures();
        AllBlockData.Enqueue(blockData);

        long millisecondsB = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;

        finishedTime = (millisecondsB - milliseconds) / 1000f;

        ThreadWorking = false;
    }
Ejemplo n.º 2
0
        public static Block Convert(byte id, BlockDataType type)
        {
            if (type == BlockDataType.RotatedBlock)
            {
                return(new RotatedBlock(id));
            }
            if (type == BlockDataType.StandaloneBlock)
            {
                return(new StandaloneBlock(id));
            }
            if (type == BlockDataType.PipeBlock)
            {
                return(new PipeBlock(id));
            }
            if (type == BlockDataType.VirusBlock)
            {
                return(new VirusBlock(id));
            }
            if (type == BlockDataType.MinerBlock)
            {
                return(new MinerBlock(id));
            }

            throw new System.InvalidCastException("Cannot cast block type");
        }
Ejemplo n.º 3
0
 public BlockDataItem(BlockDataType blockDataType, byte[] hash)
 {
     BlockDataType = blockDataType;
     Hash          = hash ?? throw new ArgumentNullException(nameof(hash));
     if (Hash.Length != 32)
     {
         throw new ArgumentException("Must be 32 bytes", nameof(hash));
     }
 }