void OnTriggerExit(Collider other) { if (other.GetType() == typeof(BoxCollider)) //TODO: make add to pool instead of destroy //CubePool.AddToPool(other.gameObject); { CubePool.AddToPool(other.gameObject); } }
void Death(Vector3 vel = default(Vector3)) { gameObject.GetComponent <BoxCollider>().enabled = false; gameObject.GetComponent <MeshRenderer>().enabled = false; float newScale = transform.localScale.x / 2; Vector3 newVectorScale = transform.localScale / 2; GetSubCubes(8); PrepSubCubesDefaults(); if (newScale < 1) { PrepDeathSubCube(); } else { PrepRegularSubCube(); } PositionSubCubes(newScale); EnableSubCubes(); GiveSubsVelocity(vel); GiveSubsTarger(); CubePool.AddToPool(gameObject); }