コード例 #1
0
    void Start()
    {
        audioManager = GameObject.FindObjectOfType <BR_AudioManager>();

        if (gameObject.name == "ControlsMenu")
        {
            sfxSlider   = null;
            musicSlider = null;
        }

        if (sfxSlider && musicSlider != null)
        {
            sfxSlider.value   = audioManager.SFXVol;
            musicSlider.value = audioManager.MusicVol;
        }


        resolutions = Screen.resolutions;

        //resolutionDropdown.ClearOptions();

        List <string> options = new List <string>();

        int currentResolutionIndex = 0;

        for (int i = 0; i < resolutions.Length; i++)
        {
            string option = resolutions[i].width + "x" + resolutions[i].height;
            options.Add(option);

            if (resolutions[i].width == Screen.currentResolution.width &&
                resolutions[i].height == Screen.currentResolution.height)
            {
                currentResolutionIndex = i;
            }
        }

        //resolutionDropdown.AddOptions(options);
        //resolutionDropdown.value = currentResolutionIndex;
        //resolutionDropdown.RefreshShownValue();

        audioManager = GameObject.FindObjectOfType <BR_AudioManager>();
    }
コード例 #2
0
ファイル: Bomb.cs プロジェクト: ecmiller/TeamHydra
    // Start is called before the first frame update
    void Start()
    {
        isLit = false;
        hasExploded = false;
        isBeeping = false;
        isHaloVisible = false;

        // Set up and deactivate the particle system for the fuse (if not already assigned)
        if (!fuseParticles)
        {
            fuseParticles = gameObject.GetComponentInChildren<ParticleSystem>(true);
            if (!fuseParticles)
            {
                Debug.Log("The particle system for " + name + " was not assigned.");
            }
        }

        fuseParticles.gameObject.SetActive(false);

        // Set up and deactivate the light indicating the bomb's blast radius (if not already assigned)
        if (!warningLight)
        {
            warningLight = gameObject.GetComponentInChildren<Light>(true);
            if (!warningLight)
            {
                Debug.Log("The warning light for " + name + " was not assigned.");
            }
        }

        else
        {
            warningLight.transform.position = gameObject.transform.position;
        }

        audioManager = FindObjectOfType<BR_AudioManager>();

        if(audioManager == null)
        {
            Debug.Log("Bomb script couldn't find an audio manager in the scene");
        }

        warningLight.gameObject.SetActive(false);
    }
コード例 #3
0
ファイル: MetalWall.cs プロジェクト: ecmiller/TeamHydra
    // Start is called before the first frame update
    void Start()
    {
        heatUp         = false;
        isPlayingSound = false;

        bR_Audio = FindObjectOfType <BR_AudioManager>();
        if (bR_Audio == null)
        {
            Debug.Log("No audio manager found for the metal wall " + gameObject.name);
        }

        if (destroyedWall == null)
        {
            Debug.Log("No destroyed version of the metal wall was assigned in the inspector");
        }

        timer         = 0;
        maxtimer      = 3;
        OriginalColor = GetComponent <Renderer> ().material.GetColor("_Color");
    }
コード例 #4
0
    public void Start()
    {
        if (SceneManager.GetActiveScene().name == "Tutorial")
        {
            Player        = Coal;
            PlayerShooter = CoalShooter;
        }
        else if (hasSelected == false)
        {
            if (Coal.activeInHierarchy == true)
            {
                Player        = Coal;
                PlayerShooter = CoalShooter;
                hasSelected   = true;
            }
            else if (Crate.activeInHierarchy == true)
            {
                Player        = Crate;
                PlayerShooter = CrateShooter;
                hasSelected   = true;
            }
            else if (Salt.activeInHierarchy == true)
            {
                Player        = Salt;
                PlayerShooter = SaltShooter;
                hasSelected   = true;
            }
        }


        if (PlayerPrefs.GetInt("reloading") == 1 && SceneManager.GetActiveScene().name != "Tutorial")
        {
            if (Coal.activeInHierarchy == true)
            {
                Coal.transform.position = playerPosition;
                Coal.GetComponent <BR_PlayerHealth>().health = healthSaved;
                Coal.GetComponent <Damage>().damageTaken     = damageTaken;
                Coal.GetComponent <BR_PlayerHealth>().UpdateHealthPieces();
                PlayerPrefs.SetInt("reloading", 0);
                hasSelected = true;
            }
            if (Crate.activeInHierarchy == true)
            {
                Crate.transform.position = playerPosition;
                Crate.GetComponent <BR_PlayerHealth>().health = healthSaved;
                Crate.GetComponent <Damage>().damageTaken     = damageTaken;
                Crate.GetComponent <BR_PlayerHealth>().UpdateHealthPieces();
                PlayerPrefs.SetInt("reloading", 0);
                hasSelected = true;
            }
            if (Salt.activeInHierarchy == true)
            {
                Salt.transform.position = playerPosition;
                Salt.GetComponent <BR_PlayerHealth>().health = healthSaved;
                Salt.GetComponent <Damage>().damageTaken     = damageTaken;
                Salt.GetComponent <BR_PlayerHealth>().UpdateHealthPieces();
                PlayerPrefs.SetInt("reloading", 0);
                hasSelected = true;
            }
        }
        Time.timeScale = 1f;

        audioManager = GameObject.FindObjectOfType <BR_AudioManager>();

        if (audioManager == null)
        {
            UnityEngine.Debug.Log("No audio manager found");
        }

        if (Checkpoints != null)
        {
            if (Checkpoints.Length == 0)
            {
                // If no checkpoints are assigned in the inspector, try finding them by tag
                Checkpoints = GameObject.FindGameObjectsWithTag("Checkpoint");

                if (Checkpoints.Length > 0)
                {
                    // If any checkpoints are in the array at this point, set the current checkpoint to the first element of the array
                    currentCheckpoint = Checkpoints[0];
                }

                else
                {
                    currentCheckpoint = null;
                }
            }
        }

        else
        {
            Checkpoints = null;
        }

        if (DeathMenu == null)
        {
            DeathMenu = GameObject.Find("DeathMenu");
        }
        if (DebugMenuUI == null)
        {
            DebugMenuUI = GameObject.Find("DebugMenu");
        }
        if (PauseMenuUI == null)
        {
            PauseMenuUI = GameObject.Find("AK_PauseMenu");
        }
    }