示例#1
0
    private void New(VCESceneSetting setting)
    {
        m_Setting = setting;
        m_IsoData = new VCIsoData();
        m_IsoData.Init(VCIsoData.ISO_VERSION, setting, new VCIsoOption(true));
        m_IsoData.m_HeadInfo.Category = setting.m_Category;
        m_Stencil = new VCIsoData();
        m_Stencil.Init(VCIsoData.ISO_VERSION, setting, new VCIsoOption(true));
        m_TempIsoMat.Init();
        m_DocumentPath = VCConfig.s_Categories[setting.m_Category].m_DefaultPath + "/Untitled" + VCConfig.s_IsoFileExt;
        int i = 2;

        while (File.Exists(VCConfig.s_IsoPath + m_DocumentPath))
        {
            m_DocumentPath = VCConfig.s_Categories[setting.m_Category].m_DefaultPath + "/Untitled (" + i.ToString() + ")" + VCConfig.s_IsoFileExt;
            ++i;
        }
        VCEditor.Instance.m_MeshMgr.m_ColorMap = m_IsoData.m_Colors;
        m_MeshComputer = new VCMCComputer();
        m_MeshComputer.Init(m_Setting.m_EditorSize, VCEditor.Instance.m_MeshMgr);
        m_CreationAttr = new CreationAttr();
#if false
        this.GenSomeVoxelForTest();
#endif
    }
示例#2
0
    public VCEScene(string iso_path)
    {
        m_IsoData = new VCIsoData();
        if (!LoadIso(iso_path))
        {
            Destroy();
            throw new Exception("Load ISO error");
        }

        VCESceneSetting isosetting = m_IsoData.m_HeadInfo.FindSceneSetting();

        if (isosetting != null)
        {
            m_Setting = isosetting;
            m_Stencil = new VCIsoData();
            m_Stencil.Init(VCIsoData.ISO_VERSION, m_Setting, new VCIsoOption(true));
            m_TempIsoMat.Init();
            m_DocumentPath = iso_path;
            VCEditor.Instance.m_MeshMgr.m_ColorMap = m_IsoData.m_Colors;
            m_MeshComputer = new VCMCComputer();
            m_MeshComputer.Init(m_Setting.m_EditorSize, VCEditor.Instance.m_MeshMgr);
            m_CreationAttr = new CreationAttr();
        }
        else
        {
            Destroy();
            throw new Exception("Scene setting error");
        }
    }
示例#3
0
    public VCEScene(VCESceneSetting setting, int template)
    {
        TextAsset asset = Resources.Load <TextAsset>("Isos/" + setting.m_Id.ToString() + "/" + template.ToString());

        if (asset == null)
        {
            New(setting);
            return;
        }

        m_IsoData = new VCIsoData();
        if (!m_IsoData.Import(asset.bytes, new VCIsoOption(true)))
        {
            Destroy();
            throw new Exception("Load Template ISO error");
        }

        VCESceneSetting isosetting = m_IsoData.m_HeadInfo.FindSceneSetting();

        if (isosetting != null)
        {
            m_Setting = isosetting;
            m_Stencil = new VCIsoData();
            m_Stencil.Init(VCIsoData.ISO_VERSION, m_Setting, new VCIsoOption(true));
            m_TempIsoMat.Init();
            m_DocumentPath = VCConfig.s_Categories[setting.m_Category].m_DefaultPath + "/Untitled" + VCConfig.s_IsoFileExt;
            int i = 2;
            while (File.Exists(VCConfig.s_IsoPath + m_DocumentPath))
            {
                m_DocumentPath = VCConfig.s_Categories[setting.m_Category].m_DefaultPath + "/Untitled (" + i.ToString() + ")" + VCConfig.s_IsoFileExt;
                ++i;
            }
            VCEditor.Instance.m_MeshMgr.m_ColorMap = m_IsoData.m_Colors;
            m_MeshComputer = new VCMCComputer();
            m_MeshComputer.Init(m_Setting.m_EditorSize, VCEditor.Instance.m_MeshMgr);
            m_CreationAttr = new CreationAttr();
        }
        else
        {
            Destroy();
            throw new Exception("Scene setting error");
        }
    }
示例#4
0
    void  InitCreationID(int creationId)
    {
        if (m_Computer != null)
        {
            m_Computer.Destroy();
        }

        CreationData crd = CreationMgr.GetCreation(creationId);

        if (crd != null)
        {
            m_CreationID   = creationId;
            m_CreationData = crd;

            m_MeshMgr  = GetComponent <VCMeshMgr>();
            m_Computer = new VCMCComputer();
            m_Computer.Init(new IntVector3(crd.m_IsoData.m_HeadInfo.xSize,
                                           crd.m_IsoData.m_HeadInfo.ySize,
                                           crd.m_IsoData.m_HeadInfo.zSize),
                            m_MeshMgr, false);

            // [VCCase] - Create box collider
            if (crd.m_Attribute.m_Type == ECreation.Vehicle ||
                crd.m_Attribute.m_Type == ECreation.Aircraft ||
                crd.m_Attribute.m_Type == ECreation.Boat ||
                crd.m_Attribute.m_Type == ECreation.SimpleObject ||
                crd.m_Attribute.m_Type == ECreation.AITurret)
            {
                m_Computer.m_CreateBoxCollider = true;
            }
        }
        else
        {
            m_CreationID   = 0;
            m_CreationData = null;
            m_Computer     = null;
            m_MeshMgr      = null;
        }
    }