// Start is called before the first frame update


    void Start()
    {
        aud           = GameObject.FindGameObjectWithTag("Music").GetComponent <AudioScript>();
        soundFX       = GameObject.FindGameObjectWithTag("SoundEffects").GetComponent <SoundEffectsScript>();
        musicSlider   = transform.GetChild(1).GetComponent <Slider>();
        soundFXSlider = transform.GetChild(2).GetComponent <Slider>();
        dropdown      = transform.GetChild(3).GetComponent <TMP_Dropdown>();
        toggle        = transform.GetChild(4).GetComponent <Toggle>();

        musicSlider.SetValueWithoutNotify(AudioScript.musicVolume);
        soundFXSlider.SetValueWithoutNotify(SoundEffectsScript.soundEffectsVolume);
        toggle.isOn = Screen.fullScreen;

        resolutions = GetResolutions();
        dropdown.ClearOptions();
        List <string> options = new List <string>();
        int           currentResolutionsIndex = 0;

        for (int i = 0; i < resolutions.Count; 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)
            {
                currentResolutionsIndex = i;
            }
        }
        dropdown.AddOptions(options);
        dropdown.value = currentResolutionsIndex;
        dropdown.RefreshShownValue();
    }
Esempio n. 2
0
    //public AudioClip explosionSound;


    // Use this for initialization
    void Start()
    {
        mainCamera     = GameObject.FindWithTag("MainCamera");
        bgPlayer       = mainCamera.GetComponent <BGMusicScript>().audioPlayer;
        player         = GameObject.FindWithTag("Player");
        playerBody     = player.GetComponent <Rigidbody2D>();
        playerRenderer = player.GetComponent <SpriteRenderer>();
        //Keeping storage of gameObject "star"
        //Need to get script from star "SingleJumpFromStar"
        myAnim         = player.GetComponent <Animator>();
        levelStartPos  = GameObject.FindWithTag("Startpoint").transform.position.x;
        levelEndPos    = GameObject.FindWithTag("Endpoint").transform.position.x;
        jumpsRemaining = maxJumps;
        canMove        = true;
        timeLeft       = gameDuration;
        pausePanel     = GameObject.FindWithTag("Pause Panel");
        pausePanel.SetActive(false);
        diedMenu = GameObject.FindWithTag("Died Menu");
        diedMenu.SetActive(false);
        fireParticles = GameObject.FindWithTag("FireParticles").transform.GetComponent <ParticleSystem>();
        fireParticles.Stop();
        iceParticles = GameObject.FindWithTag("IceParticles").transform.GetComponent <ParticleSystem>();
        iceParticles.Stop();
        isFrozen         = false;
        jetPackParticles = GameObject.FindWithTag("JetPackparticles").transform.GetComponent <ParticleSystem>();
        jetPackParticles.Stop();
        jetPackParticles.Clear();
        gameplaySound = GameObject.FindWithTag("SFX Player").GetComponent <SoundEffectsScript>();
        //To save the custom speed in inspector
        speedSave = speed;
    }
Esempio n. 3
0
    // Use this for initialization
    void Start()
    {
        Messenger.AddListener <GameObject> ("exitObstacle", exitedCollider);
        Messenger.AddListener <GameObject> ("disappear", disappearObstacle);
        Messenger.AddListener <GameObject> ("enteredObstacle", enteredCollider);
        Messenger.AddListener("clearOutLane", clearOutLane);
        Messenger.AddListener("ranOutOfHealth", ranOutOfHealth);
        Messenger.AddListener("landed", landed);
        Messenger.AddListener("jumped", jumped);
        Messenger.AddListener <bool> ("isLaneEnabled", laneEnabled);
        Messenger.AddListener("hitPowerBox", hitPowerBox);
        cam               = Camera.main;
        scoreController   = new ScoreController();
        timerController   = new TimerController(() => TimesUp());
        cameraScript      = cam.GetComponent <CameraScript> ();
        bounds            = CameraExtensions.OrthographicBounds(cam);
        audioScript       = GameObject.FindGameObjectWithTag("AudioController").GetComponent <AudioScript> ();
        soundEffectScript = GameObject.FindGameObjectWithTag("SoundEffectsController").GetComponent <SoundEffectsScript> ();

        currentGameLevel = LevelManager.Instance.getCurrentLevelDetail();
        timerController.beginTimer(currentGameLevel.lengthInSeconds * 1000);
                #if UNITY_ANDROID
        touch = new TouchGesture(this.gestureSetting);
        StartCoroutine(touch.CheckHorizontalSwipes(
                           onLeftSwipe: () => { moveRight(); },
                           onRightSwipe: () => { moveLeft(); }
                           ));
                #endif
    }
Esempio n. 4
0
	void Awake()
	{
		// Register the singleton
		if (Instance != null)
		{
			Debug.LogError("Multiple instances of SoundEffectsHelper!");
		}
		Instance = this;
	}
 void Awake()
 {
     // create singleton
     if (Instance != null)
     {
         Debug.LogError("Multiple instances of SoundEffectsHelper!");
     }
     Instance = this;
 }
Esempio n. 6
0
 private void Start()
 {
     soundFX        = GameObject.FindGameObjectWithTag("SoundEffects").GetComponent <SoundEffectsScript>();
     canvas         = GameObject.FindGameObjectWithTag("Canvas");
     multiplyPanel  = canvas.transform.GetChild(0);
     victoryPanel   = canvas.transform.GetChild(1);
     menu           = canvas.transform.GetChild(2);
     options        = canvas.transform.GetChild(3);
     spriteRenderer = GetComponent <SpriteRenderer>();
 }
Esempio n. 7
0
 // Start is called before the first frame update
 private void Start()
 {
     rowSize = transform.parent.transform.GetComponent <MatrixScript>().matrixSize;
     for (int i = 0; i < rowSize; i++)
     {
         numbersObject.Add(Instantiate(number));
         numbersObject[i].transform.position = new Vector3((transform.position.x - ((rowSize - 1) / 2f)) + i, transform.position.y);
         numbersObject[i].transform.parent   = transform;
     }
     foreach (Transform child in transform)
     {
         if (child.tag == "Plus")
         {
             child.transform.position = new Vector3((transform.position.x - ((rowSize - 1) / 2f)) + rowSize + 1, transform.position.y);
         }
         else if (child.tag == "Minus")
         {
             child.transform.position = new Vector3((transform.position.x - ((rowSize - 1) / 2f)) - 2, transform.position.y);
         }
         else if (child.tag == "Multiply")
         {
             child.transform.position = new Vector3((transform.position.x - ((rowSize - 1) / 2f)) + rowSize + 2, transform.position.y);
         }
         else if (child.tag == "Divide")
         {
             child.transform.position = new Vector3((transform.position.x - ((rowSize - 1) / 2f)) - 3, transform.position.y);
         }
     }
     transform.GetComponent <BoxCollider2D>().size = new Vector2(rowSize, 1);
     originalPos     = transform.localPosition;
     initialPosition = transform.localPosition;
     originalScale   = transform.localScale;
     soundFX         = GameObject.FindGameObjectWithTag("SoundEffects").GetComponent <SoundEffectsScript>();
     rowScript       = transform.GetComponent <RowScript>();
     canvas          = GameObject.FindGameObjectWithTag("Canvas");
     multiplyPanel   = canvas.transform.GetChild(0);
     victoryPanel    = canvas.transform.GetChild(1);
     menu            = canvas.transform.GetChild(2);
     options         = canvas.transform.GetChild(3);
 }
 private void Awake()
 {
     instance    = this;
     audioSource = GetComponent <AudioSource>();
 }
 private void Awake()
 {
     Instance = this;
 }
Esempio n. 10
0
 public void Start()
 {
     soundFX = GameObject.FindGameObjectWithTag("SoundEffects").GetComponent <SoundEffectsScript>();
 }
 private void Awake()
 {
     Instance = this;
 }