void MoveTransformRadial(Transform transform, float deltaRadius)

    {
        Vector3 disp = Vector3.Normalize(transform.position.WithZ(0)) * deltaRadius;

        Undo.RecordObject(transform, "Move Radially");
        transform.position += disp;

        foreach (Transform subtransform in transform)
        {
            Undo.RecordObject(subtransform, "Move Radially");
            subtransform.position -= disp;

            MoveTransformRadial(subtransform, deltaRadius);
        }

        ArcMesh arcMesh = transform.gameObject.GetComponent <ArcMesh>();

        if (arcMesh != null)
        {
            //Undo.RegisterCompleteObjectUndo(arcMesh, "Move Radially");
            //Undo.RecordObjects(new Object[] { arcMesh, arcMesh.gameObject.GetComponent<MeshFilter>(), arcMesh.gameObject.GetComponent<PolygonCollider2D>() }, "Move Radially");
            arcMesh.SetParams(arcMesh.InnerRadius + deltaRadius, arcMesh.OuterRadius + deltaRadius, arcMesh.ArcNumerator, arcMesh.ArcDenominator, arcMesh.AngularResolution, arcMesh.ZOffset, true);
        }
    }
Exemple #2
0
 private void Awake()
 {
     arcMesh             = GetComponentInChildren <ArcMesh>();
     arcMesh.parent      = this;
     audioSource         = GetComponent <AudioSource>();
     audioRange          = GetComponentInChildren <SphereCollider>();
     CurrentHealthPoints = MaxHealthPoints;
 }