Esempio n. 1
0
    void Reset()
    {
        MegaModifyObject modobj = (MegaModifyObject)gameObject.GetComponent <MegaModifyObject>();

        if (modobj != null)
        {
            modobj.ModReset(this);
        }

        if (GetComponent <Renderer>() != null)
        {
            Mesh ms = MegaUtils.GetSharedMesh(gameObject);

            if (ms != null)
            {
                Bounds b = ms.bounds;
                Offset   = -b.center;
                bbox.min = b.center - b.extents;
                bbox.max = b.center + b.extents;
            }
        }

        bsize   = bbox.Size();
        bcenter = bbox.center;
        Init();
    }
Esempio n. 2
0
	void Reset()
	{
		MegaModifyObject modobj = (MegaModifyObject)gameObject.GetComponent<MegaModifyObject>();

		if ( modobj != null )
			modobj.ModReset(this);
	}
    void Reset()
    {
#if false
        MegaModifyObject modobj = (MegaModifyObject)gameObject.GetComponent <MegaModifyObject>();

        if (modobj != null)
        {
            modobj.ModReset(this);
        }

        Renderer rend = GetComponent <Renderer>();

        if (rend != null)
        {
            Mesh ms = MegaUtils.GetSharedMesh(gameObject);

            if (ms != null)
            {
                Bounds b = ms.bounds;
                Offset   = -b.center;
                bbox.min = b.center - b.extents;
                bbox.max = b.center + b.extents;
            }
        }

        if (modobj.selection != null)
        {
            Bounds bb = new Bounds();
            for (int i = 0; i < modobj.verts.Length; i++)
            {
                if (modobj.selection[i] > 0.001f)
                {
                    bb.Encapsulate(modobj.verts[i]);
                }
            }

            Offset   = -bb.center;
            bbox.min = bb.center - bb.extents;
            bbox.max = bb.center + bb.extents;
        }

        bsize   = bbox.Size();
        bcenter = bbox.center;
        Init();
#endif
    }