public void CombineWith(AbstractPrimitiveProduct other) { // prevent self interaction if (other == this) return; if (other.gameObject == null) return; if (other.meshRenderer != null) { // Combine colors onto this product. Color newColor = other.color + this.color; this.color = newColor; this.meshRenderer.material.color = newColor; } gameObject.transform.localScale *= 1.1f; Vector3 newPosition = 0.5f * (other.gameObject.transform.position - gameObject.transform.position); gameObject.transform.position += newPosition; GameObject.Destroy(other.gameObject); other = null; }
public void CombineWith(AbstractPrimitiveProduct other) { // prevent self interaction if (other == this) { return; } if (other.gameObject == null) { return; } if (other.meshRenderer != null) { // Combine colors onto this product. Color newColor = other.color + this.color; this.color = newColor; this.meshRenderer.material.color = newColor; } gameObject.transform.localScale *= 1.1f; Vector3 newPosition = 0.5f * (other.gameObject.transform.position - gameObject.transform.position); gameObject.transform.position += newPosition; GameObject.Destroy(other.gameObject); other = null; }