示例#1
0
文件: Map.cs 项目: Ville1/3DSurvival
 private Map()
 {
     game_object                     = GameObject.Find("Map");
     Block_Container                 = GameObject.Find("Map/Blocks");
     Entity_Container                = GameObject.Find("Map/Entitys");
     blocks                          = new List <Block>();
     chunks                          = new List <Chunk>();
     active_chunks                   = new List <Chunk>();
     entities                        = new List <Entity>();
     entities_to_be_added            = new List <Entity>();
     entities_to_be_removed          = new List <Entity>();
     blocks_to_be_added              = new List <Block>();
     blocks_to_be_removed            = new List <Block>();
     active                          = false;
     Rendering_Distance              = 30;
     chunk_index_x                   = 0;
     chunk_index_z                   = 0;
     generation_loop                 = 0;
     second_loop_count               = 0;
     third_loop_count                = 0;
     stopwatch                       = null;
     loop_time_1                     = 0.0f;
     loop_time_2                     = 0.0f;
     loop_time_3                     = 0.0f;
     paused                          = false;
     chunks_processed                = 0;
     Current_State                   = State.Normal;
     recent_blocks                   = new List <Block>();
     remove_base_pilar_support       = null;
     remove_base_pilar_support_queue = new List <Block>();
     deleting_old                    = false;
     entities_deleted                = false;
     Structural_Integrity_Manager    = new StructuralIntegrityManager(this);
 }
示例#2
0
文件: Map.cs 项目: Ville1/3DSurvival
    public void Generate_New(int size_y, int chunck_count_x, int chunk_count_z, bool limited_generation, bool simple_elevation, bool structural_integrity_enabled)
    {
        if (PRINT_DIAGNOSTICS)
        {
            stopwatch = Stopwatch.StartNew();
        }
        Start_Delete();
        chunk_index_x     = 0;
        chunk_index_z     = 0;
        generation_loop   = 0;
        second_loop_count = 0;
        third_loop_count  = 0;
        loop_time_1       = 0.0f;
        loop_time_2       = 0.0f;
        loop_time_3       = 0.0f;

        Size_Y = size_y;
        Chunk_Generation_Radius_Size_X = Mathf.RoundToInt((Rendering_Distance * 3.0f) / Chunk.SIZE_X);
        Chunk_Generation_Radius_Size_Z = Mathf.RoundToInt((Rendering_Distance * 3.0f) / Chunk.SIZE_Z);
        Initial_Chunk_Size_X           = chunck_count_x;
        Initial_Chunk_Size_Z           = chunk_count_z;
        Limited_Generation             = limited_generation;
        Simple_Elevation             = simple_elevation;
        Structural_Integrity_Enabled = structural_integrity_enabled;
        Structural_Integrity_Manager = new StructuralIntegrityManager(this);

        Current_State = State.Generating;
        ProgressBarManager.Instance.Active = true;
        Update_Progress();
    }