Пример #1
0
    public void Load()
    {
        if (current != null)
        {
            return;
        }
        current = this;

        buildEmitter = Instantiate(Resources.Load <ParticleSystem>("buildEmitter"));

        lightPassengerShip_pref = Resources.Load <GameObject>("Prefs/lightPassengerShip");
        lightCargoShip_pref     = Resources.Load <GameObject>("Prefs/lightCargoShip");
        lightWarship_pref       = Resources.Load <GameObject>("Prefs/lightWarship");
        privateShip_pref        = Resources.Load <GameObject>("Prefs/privateShip");
        lightPassengerShips     = new List <GameObject>();
        lightCargoShips         = new List <GameObject>();
        lightWarships           = new List <GameObject>();
        privateShips            = new List <GameObject>();

        plane_excavated_025 = Resources.Load <Mesh>("Meshes/Plane_excavated_025");
        plane_excavated_05  = Resources.Load <Mesh>("Meshes/Plane_excavated_05");
        plane_excavated_075 = Resources.Load <Mesh>("Meshes/Plane_excavated_075");

        lr_red_material   = Resources.Load <Material>("Materials/GUI_Red");
        lr_green_material = Resources.Load <Material>("Materials/GUI_Green");

        zoneCube  = Instantiate(Resources.Load <Transform>("Prefs/zoneCube"), transform); zoneCube.gameObject.SetActive(false);
        cavePref  = Resources.Load <GameObject>("Prefs/CaveBlock_pref");
        quadsPool = new List <GameObject>();
        quad_pref = Instantiate(Resources.Load <GameObject>("Prefs/quadPref"), transform);               // ууу, костыль! а если текстура не 4 на 4 ?
        //quad_pref.GetComponent<MeshFilter>().sharedMesh.uv = new Vector2[] { new Vector2(0.02f, 0.02f), new Vector2(0.98f, 0.98f), new Vector2(0.98f, 0.02f), new Vector2(0.02f, 0.98f) };
        quad_pref.GetComponent <MeshFilter>().sharedMesh.uv = new Vector2[] { Vector2.zero, Vector2.one, Vector2.right, Vector2.up };
        quad_pref.transform.parent = transform;
        quad_pref.SetActive(false);
        quadsPool.Add(quad_pref);

        default_material        = Resources.Load <Material>("Materials/Default");
        darkness_material       = Resources.Load <Material>("Materials/Darkness");
        energy_material         = Resources.Load <Material>("Materials/ChargedMaterial");
        energy_offline_material = Resources.Load <Material>("Materials/UnchargedMaterial");
        basic_material          = Resources.Load <Material>("Materials/Basic");
        glass_material          = Resources.Load <Material>("Materials/Glass");
        glass_offline_material  = Resources.Load <Material>("Materials/GlassOffline");
        metal_material          = Resources.Load <Material>("Materials/Metal");
        green_material          = Resources.Load <Material>("Materials/Green");
        billboardMaterial       = Resources.Load <Material>("Materials/BillboardMaterial");

        basic_illuminated = new Material[MAX_MATERIAL_LIGHT_DIVISIONS];
        green_illuminated = new Material[MAX_MATERIAL_LIGHT_DIVISIONS];
        metal_illuminated = new Material[MAX_MATERIAL_LIGHT_DIVISIONS];

        mineElevator_pref = Resources.Load <GameObject>("Structures/MineElevator");
        QuestUI.LoadTextures();
        gui_overridingSprite = Resources.Load <Sprite>("Textures/gui_overridingSprite");
    }