Esempio n. 1
0
        void UpdateMesh_Editor()
        {
            bool updated = false;

            if (updateDetecter == null)
            {
                updateDetecter = new EditablePolygon2D.UpdateDetecter(this.gameObject);
            }
            if (updateChekcer == null)
            {
                updateChekcer = new UpdateChecker();
            }

            updated |= meshFilter.sharedMesh == null;
            updated |= updateDetecter.IsUpdated();
            updated |= updateChekcer.IsUpdated(meshDrawer);

            updateDetecter.Update();
            updateChekcer.Update(meshDrawer);

            if (updated)
            {
                MakeMesh(updateDetecter.GetPointsFromGameCollider());
            }
        }
Esempio n. 2
0
        void Start()
        {
            updateDetecter = new EditablePolygon2D.UpdateDetecter(this.gameObject);
            updateDetecter.Reset();
            meshFilter   = this.GetComponent <MeshFilter>();
            meshRenderer = this.GetComponent <MeshRenderer>();

            updateChekcer = new UpdateChecker();

            if (!Application.isPlaying)
            {
                if (myId != 0 && myId != gameObject.GetInstanceID())
                {
                    meshFilter.sharedMesh = null;
                }
                myId = this.gameObject.GetInstanceID();
                InitMeshUpdate_Editor();

                //Debug.Log("start " + this.gameObject.name + " "+Time.frameCount);
            }
            else
            {
                if (meshFilter.sharedMesh == null)
                {
                    InitMeshUpdate_Editor();
                }
                this.enabled = false;
            }
        }
Esempio n. 3
0
 void InitMeshUpdate_Editor()
 {
     if (meshFilter.sharedMesh == null)
     {
         UpdateMesh_Editor();
     }
     else
     {
         if (updateDetecter == null)
         {
             updateDetecter = new EditablePolygon2D.UpdateDetecter(this.gameObject);
         }
         if (updateChekcer == null)
         {
             updateChekcer = new UpdateChecker();
         }
         updateDetecter.Update();
         updateChekcer.Update(meshDrawer);
     }
 }