Esempio n. 1
0
    void Start()
    {
        _mesh = planeObj.GetComponent <MeshFilter>().mesh;
        _simp = new Simplification(_mesh.vertices, _mesh.triangles);

        _nextUpdateTime = Time.time + updateInterval;

        if (!interactive)
        {
            StartCoroutine("Collapse");
        }
    }
Esempio n. 2
0
    public ImageGameObjectUtility(Texture aTex, System.Nullable <Vector2> aSize = null)
    {
        ParentObject = new GameObject("genImageObjectParent");
        //PlaneObject = GameObject.CreatePrimitive(PrimitiveType.Plane);
        PlaneObject = (GameObject)GameObject.Instantiate(ManagerManager.Manager.mReferences.mPlanePrefab);
        //GameObject.DestroyImmediate(PlaneObject.GetComponent<BoxCollider>());
        PlaneMaterial = new Material(ManagerManager.Manager.mReferences.mDefaultCharacterShader);
        PlaneObject.GetComponent <Renderer>().material = PlaneMaterial;
        set_new_texture(aTex, aSize);

        PlaneObject.transform.rotation  = Quaternion.AngleAxis(90, Vector3.right) * PlaneObject.transform.rotation;
        PlaneObject.transform.parent    = ParentObject.transform;
        ParentObject.transform.position = new Vector3(12321, 124345, 1234);       //this will solve some one frame appearance glitches
    }
Esempio n. 3
0
 public void set_new_texture(Texture aTex, System.Nullable <Vector2> aSize = null)
 {
     aSize *= GameConstants.SCALE;
     if (aSize == null)
     {
         if (aTex != null)
         {
             BaseDimension = new Vector2(aTex.width, aTex.height);
         }
         else
         {
             BaseDimension = new Vector2(1, 1);
         }
     }
     else
     {
         BaseDimension = aSize.Value;
     }
     PlaneObject.GetComponent <Renderer>().material.mainTexture = aTex;
     PixelDimension = BaseDimension;
 }