Пример #1
0
 // Start is called before the first frame update
 void Start()
 {
     caughtTrash       = new List <string>();
     gameManagerScript = GameObject.Find("GameManager").GetComponent <GameManagerScript>();
     comboTextScript   = GameObject.Find("ComboText").GetComponent <ComboTextScript>();
     pickUpSE          = GameObject.Find("PickUp").GetComponent <AudioSource>();
     throwSE           = GameObject.Find("Throw").GetComponent <AudioSource>();
     wrongSE           = GameObject.Find("Wrong").GetComponent <AudioSource>();
 }
Пример #2
0
    public void InitialSetup()
    {
        gameRunning          = false;
        gameLooping          = false;
        difficulty           = 1;
        score                = 0f;
        coinsCollected       = 0;
        planetCombo          = 0;
        maxPlanetCombo       = 0;
        planetDestroyedCount = 0;
        planetsOnScreenCount = 0;
        mapManager           = GameObject.FindObjectOfType <MapManager>();
        player               = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerScript>();
        gameCanvas           = GameObject.FindGameObjectWithTag("GameCanvas");
        topBar               = gameCanvas.transform.Find("Top Bar").gameObject;
        playerHUD            = gameCanvas.transform.Find("Player HUD").GetComponent <PlayerHUDScript>();
        comboText            = gameCanvas.transform.Find("Combo Text").GetComponent <ComboTextScript>();

        notificationObj = gameCanvas.transform.Find("Notification").gameObject;
        notificationObj.SetActive(false);
        notificationObj.transform.Find("Restart Button").GetComponent <Button>().onClick.AddListener(() => LoadGame());
        notificationObj.transform.Find("Upgrades Button").GetComponent <Button>().onClick.AddListener(() => LoadUpgrade());
        notificationObj.transform.Find("Main Menu Button").GetComponent <Button>().onClick.AddListener(() => LoadMainMenu());

        pauseBoxObj = gameCanvas.transform.Find("Pause Box").gameObject;
        pauseBoxObj.SetActive(false);
        pauseBoxObj.transform.Find("Resume Button").GetComponent <Button>().onClick.AddListener(() => OnPauseButtonClick());
        pauseBoxObj.transform.Find("Restart Button").GetComponent <Button>().onClick.AddListener(() => LoadGame());
        pauseBoxObj.transform.Find("Upgrades Button").GetComponent <Button>().onClick.AddListener(() => LoadUpgrade());
        pauseBoxObj.transform.Find("Main Menu Button").GetComponent <Button>().onClick.AddListener(() => LoadMainMenu());
        gamePaused = false;

        difficultyIncreaseText = gameCanvas.transform.Find("Difficulty Increase Text").gameObject;
        difficultyIncreaseText.SetActive(false);

        player.SetCanControl(false);
    }