// Use this for initialization void Start() { breakablePlatform = new BreakablePlatform(); breakablePlatform.timeToLive = timeToLive; breakablePlatform.timeToRecover = timeToRecover; breakablePlatform.spawn = gameObject.transform; }
void MyPlatformBroke(BreakablePlatform platform) { RaycastHit hit; if (Physics.Raycast(destinationTransform.position, Vector3.down, out hit, 1000.0f)) { destinationTransform.position = new Vector3(destinationTransform.position.x, hit.point.y + .5f, destinationTransform.position.z); } else { destinationTransform.position += Vector3.down * 1000000; } currentState = MovingState.Falling; }