コード例 #1
0
    public override void UpdateEntity(bool for_editor)
    {
        if (for_editor)
        {
            VCEComponentTool tool = m_Entity.GetComponent <VCEComponentTool>();
            tool.m_Data = this;
        }
        m_Rotation = VCEMath.NormalizeEulerAngle(m_Rotation);
        m_Entity.transform.localPosition    = m_Position;
        m_Entity.transform.localEulerAngles = m_Rotation;
        m_Entity.transform.localScale       = m_Scale;
        VCDecalHandler dh = m_Entity.GetComponent <VCDecalHandler>();

        if (for_editor)
        {
            dh.m_Guid       = m_Guid;
            dh.m_Iso        = null;
            dh.m_AssetIndex = -1;
        }
        else
        {
            dh.m_Guid       = 0;
            dh.m_Iso        = m_CurrIso;
            dh.m_AssetIndex = m_AssetIndex;
        }
        dh.m_Size        = m_Size;
        dh.m_Depth       = m_Depth;
        dh.m_Mirrored    = m_Mirrored;
        dh.m_ShaderIndex = m_ShaderIndex;
        dh.m_Color       = m_Color;
    }
コード例 #2
0
    void OnEnable()
    {
        float voxel_size = VCEditor.s_Scene.m_Setting.m_VoxelSize;

        if (m_DecalInst != null)
        {
            GameObject.Destroy(m_DecalInst.gameObject);
            m_DecalInst = null;
        }
        m_DecalInst = (GameObject.Instantiate(m_DecalPrefab) as GameObject).GetComponent <VCDecalHandler>();
        m_DecalInst.gameObject.SetActive(false);
        m_DecalInst.transform.parent        = this.transform;
        m_DecalInst.transform.localPosition = Vector3.zero;
        m_DecalInst.transform.localScale    = Vector3.one;
        m_DecalInst.m_Guid        = VCEditor.SelectedDecalGUID;
        m_DecalInst.m_Depth       = voxel_size;
        m_DecalInst.m_Size        = voxel_size * 10;
        m_DecalInst.m_Mirrored    = false;
        m_DecalInst.m_ShaderIndex = 0;
        m_Tool            = m_DecalInst.GetComponent <VCEComponentTool>();
        m_Tool.m_IsBrush  = true;
        m_Tool.m_InEditor = true;
        m_Tool.m_ToolGroup.SetActive(true);
    }