Example #1
0
 public void SetupWindow(JellyObject targetJelly)
 {
     _target  = targetJelly;
     _texture = _target.GetComponent <SpriteRenderer>().sprite.texture;
     if (_target.GetComponent <PolygonCollider2D>())
     {
         _points = _target.GetComponent <PolygonCollider2D>().points;
     }
     else
     {
         _points = _target.gameObject.AddComponent <PolygonCollider2D>().points;
     }
     _render = true;
 }
 public void SetupWindow(JellyObject targetJelly)
 {
     _target = targetJelly;
     _texture = _target.GetComponent<SpriteRenderer>().sprite.texture;
     if (_target.GetComponent<PolygonCollider2D>())
     {
         _points = _target.GetComponent<PolygonCollider2D>().points;
     }
     else
     {
         _points = _target.gameObject.AddComponent<PolygonCollider2D>().points;
     }
     _render = true;
 }
Example #3
0
        private void LoadOutlinePoints()
        {
            _texture = _target.GetComponent <SpriteRenderer>().sprite.texture;
            if (_target.GetComponent <PolygonCollider2D>())
            {
                _points = _target.GetComponent <PolygonCollider2D>().points.ToList();
            }
            else
            {
                _points = _target.gameObject.AddComponent <PolygonCollider2D>().points.ToList();
            }

            _points.Add(_points [0]);

            DestroyImmediate(_target.GetComponent <PolygonCollider2D> ());

            DestroyImmediate(_oldShape);
            MeshBuilder.Instance.BuildMesh2D(_points, ShapeBuilt);
        }