Exemplo n.º 1
0
  public static void SetupSprite2DGameObject(GameObject newGameObject)
  {
      Slicer2D.Sliceable2D sliceable = newGameObject.AddComponent <Slicer2D.Sliceable2D>();

      CircleCollider2D collider = newGameObject.AddComponent <CircleCollider2D>();

      Utilities2D.ColliderLineRenderer2D lineRenderer = newGameObject.AddComponent <Utilities2D.ColliderLineRenderer2D>();

      lineRenderer.lineWidth = 0.25f;

      newGameObject.transform.position = GetCameraPoint();
  }
Exemplo n.º 2
0
  public static void SetupMesh2DGameObject(GameObject newGameObject)
  {
      Slicer2D.Sliceable2D sliceable = newGameObject.AddComponent <Slicer2D.Sliceable2D>();

      sliceable.textureType = Slicer2D.Sliceable2D.TextureType.Mesh2D;

      sliceable.materialSettings.material       = new Material(Shader.Find("Sprites/Default"));
      sliceable.materialSettings.material.color = Color.white;

      Utilities2D.ColliderLineRenderer2D lineRenderer = newGameObject.AddComponent <Utilities2D.ColliderLineRenderer2D>();

      lineRenderer.lineWidth = 0.25f;

      newGameObject.transform.position = GetCameraPoint();
  }
        override public void OnInspectorGUI()
        {
            ColliderLineRenderer2D script = target as ColliderLineRenderer2D;

            script.customColor = EditorGUILayout.Toggle("Custom Color", script.customColor);

            script.color = EditorGUILayout.ColorField("Color", script.color);

            script.lineWidth = EditorGUILayout.FloatField("Line Width", script.lineWidth);

            script.drawEdgeCollider = EditorGUILayout.Toggle("Edge Collider", script.drawEdgeCollider);

            if (GUILayout.Button("Update Renderer"))
            {
                script.Initialize();
            }
        }