public void GameOver()
    {
        gameOvered = true;


        dead_menu.SetActive(true);//kizor
        head_parent.SetActive(false);
        head_parent.SetActive(true);
        head_parent.transform.Find("PauseButton").gameObject.SetActive(false);
        ExplosionsCall.BallExplosion(gameObject.transform.position, false);
        gameObject.SetActive(false);//kizor
        if (Application.loadedLevel == 2)
        {
            if (score > PlayerPrefs.GetInt("high score"))
            {
                dead_menu.transform.Find("HighScore").gameObject.SetActive(false);
            }
            else
            {
                dead_menu.transform.Find("NewHighScore").gameObject.SetActive(false);
            }
            Game.NewHighScore(score);
        }
        Time_scale_controller.RebootTimeVariables();
    }
Beispiel #2
0
    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();
     }
 }