public void UpdateCollidable() { if (destructibleSprite == null) { destructibleSprite = GetComponent <D2D_DestructibleSprite>(); } if (child == null) { child = D2D_Helper.CreateGameObject("Colliders", transform); } alphaTex = destructibleSprite.AlphaTex; var colliderScale = destructibleSprite.CalculateAlphaTexScale(); var colliderOffset = destructibleSprite.CalculateAlphaTexOffset(); if (child.transform.localPosition != colliderOffset) { child.transform.localPosition = colliderOffset; } if (child.transform.localScale != colliderScale) { child.transform.localScale = colliderScale; } }
private void UpdateMass() { if (destructibleSprite == null) destructibleSprite = GetComponent<D2D_DestructibleSprite>(); var newMass = destructibleSprite.SolidPixelCount * MassPerPixel; if (rigidbody2D.mass != newMass) { rigidbody2D.mass = newMass; } }
private void UpdateMass() { if (destructibleSprite == null) { destructibleSprite = GetComponent <D2D_DestructibleSprite>(); } var newMass = destructibleSprite.SolidPixelCount * MassPerPixel; if (rigidbody2D.mass != newMass) { rigidbody2D.mass = newMass; } }
public void UpdateCollidable() { if (destructibleSprite == null) destructibleSprite = GetComponent<D2D_DestructibleSprite>(); if (child == null) child = D2D_Helper.CreateGameObject("Colliders", transform); alphaTex = destructibleSprite.AlphaTex; var colliderScale = destructibleSprite.CalculateAlphaTexScale(); var colliderOffset = destructibleSprite.CalculateAlphaTexOffset(); if (child.transform.localPosition != colliderOffset) { child.transform.localPosition = colliderOffset; } if (child.transform.localScale != colliderScale) { child.transform.localScale = colliderScale; } }