void LateUpdate() { gridX = (int)Mathf.Round(transform.position.x / Metrics.scale); gridZ = (int)Mathf.Round(transform.position.z / Metrics.scale); if (gridX >= Metrics.xBlocks() || gridX < 0 || gridZ >= Metrics.zBlocks() || gridZ < 0) { return; //die(); } else if (mapMother.getHeight(gridX, gridZ) * Metrics.getVScale() > transform.position.y) { die(); } }
void Update() { gridX = (int)Mathf.Round(transform.position.x / Metrics.scale); gridZ = (int)Mathf.Round(transform.position.z / Metrics.scale); if (gridX < Metrics.xBlocks() && gridX >= 0 && gridZ < Metrics.zBlocks() && gridZ >= 0 && mapMother.getHeight(gridX, gridZ) * Metrics.getVScale() > transform.position.y) { Explode(); } }