public void OnDestroy() { List <GameObject> objects_to_destroy = new List <GameObject>(); for (int i = 0; i < Obstacle_creater.created_obstacles.Count; i++) { GameObject obstacle = Obstacle_creater.created_obstacles[i]; if (obstacle) { if ((ball.transform.position - obstacle.transform.position).magnitude < destroing_range) { Obstacle_creater.created_obstacles.Remove(obstacle); ExplosionsCall.ObstacleExplosion(obstacle.transform.position, false); Destroy(obstacle); } } } for (int i = 0; i < Obstacle_creater.created_obstacles.Count; i++) { GameObject obstacle = Obstacle_creater.created_obstacles[i]; if (obstacle) { } else { Obstacle_creater.created_obstacles.Remove(obstacle); } } red_flame.SetActive(false); blue_flame.SetActive(true); }
private void on_obstacle_enter(GameObject obstacle) { if (player_effects.GetComponent <Shield_boost>() || player.GetComponent <Rocket_boost>()) { ExplosionsCall.ObstacleExplosion(obstacle.transform.position, false);///взрыв Destroy(obstacle); } else { GameOver(); } }