void Start()
 {
     LevelNumber.setSkipIntro(true);     //main menu intro should no longer be played when returning to it
     ftlJump = GameObject.FindGameObjectWithTag("StarList").GetComponent <FTLJump>();
     ftlJump.stopAllStars();
     blackPanel.gameObject.GetComponent <Image>().enabled = true;
     if (LevelNumber.getLoadedFromMenu())
     {
         blackPanel.setColors(new Color(0, 0, 0, 1), new Color(0, 0, 0, 0));
         preventPauseTimer = 2.5f;
     }
     else
     {
         blackPanel.setColors(new Color(0, 0, 0, 0), new Color(0, 0, 0, 0));
         try
         {
             chargeBar.setProgress(0);
             chargeText.setPercent(0);
         } catch
         {
         }
     }
     blackPanel.startColorChange();
     LevelNumber.setLoadedFromMenu(false);
     shipAudio.clip = shipHit;
     highScores     = getHighScores();
     bombCooldown   = setBombCooldown;
 }
Beispiel #2
0
 void Start()
 {
     GameState.playTransition = false;
     if (playOnAwake)
     {
         colorLerp.startColorChange();
     }
     startColor = colorLerp.startColor;
     endColor   = colorLerp.endColor;
 }
    public IEnumerator displayText(float holdColorDuration)
    {
        colorLerp.initialDelay = 0;
        Color startColor = text.color;
        Color endColor   = startColor;

        startColor.a = 0;
        colorLerp.setColors(startColor, endColor);
        colorLerp.startColorChange();
        yield return(new WaitForSeconds(colorLerp.duration + holdColorDuration));

        colorLerp.setColors(endColor, startColor);
        colorLerp.startColorChange();
    }
Beispiel #4
0
    public IEnumerator loadAfterDelay(string sceneName, float delay)
    {
        fadeToBlack.startColorChange();
        yield return(new WaitForSeconds(delay));

        SceneManager.LoadScene(sceneName);
    }
Beispiel #5
0
    private IEnumerator loadAfterDelay(string nextScene, float delay)
    {
        fadeToBlack.startColorChange();
        continueButton.interactable = false;
        yield return(new WaitForSeconds(delay));

        SceneManager.LoadScene(nextScene);
    }
    public IEnumerator loadAfterDelay(string sceneName, float delay)
    {
        fadeToBlack.startColorChange();
        sendButton.GetComponent <Button>().interactable = false;
        yield return(new WaitForSeconds(delay));

        SceneManager.LoadScene(sceneName);
    }
Beispiel #7
0
    //comment this coroutine to get second text fade in
    IEnumerator Example()
    {
        flavorColorLerp.startColorChange();
        yield return(new WaitForSeconds(3));

        flavorColorLerp2.startColorChange();
        yield return(new WaitForSeconds(3));
    }
Beispiel #8
0
    private IEnumerator loadSurvival()
    {
        blackPanel.gameObject.GetComponent <Image>().enabled = true;
        blackPanel.startColorChange();
        yield return(new WaitForSeconds(1.5f));

        SceneManager.LoadScene("Survival");
    }
    private IEnumerator loadLevel()
    {
        levelTransition = true;
        LevelNumber.setLevel(levelIndex);
        blackPanel.gameObject.GetComponent <Image>().enabled = true;
        blackPanel.startColorChange();
        yield return(new WaitForSeconds(1.5f));

        SceneManager.LoadScene("Campaign");
    }
Beispiel #10
0
    private IEnumerator hideBothTexts(float delay)
    {
        yield return(new WaitForSeconds(delay));

        Color start  = colorLerp1.startColor;
        Color finish = colorLerp1.endColor;

        colorLerp1.startColor = finish;
        colorLerp1.endColor   = start;
        colorLerp2.startColor = finish;
        colorLerp2.endColor   = start;
        colorLerp1.startColorChange();
        colorLerp2.startColorChange();
    }
    public void scrollRight()
    {
        if (levelIndex < levels.Count - 1)
        {
            levels[levelIndex++].hideUI(1);
            levels[levelIndex].revealUI(1);
            menuController.menuEffects.clip = soundOnMoveOK;
        }
        else
        {
            menuController.menuEffects.clip = soundOnMoveFail;
        }
        rightArrow.startColorChange();

        inputDisabledTimer = delayAfterInput;
        menuController.menuEffects.Play();
    }
    public void scrollLeft()
    {
        if (levelIndex > 0)
        {
            levels[levelIndex--].hideUI(-1);
            levels[levelIndex].revealUI(-1);
            menuController.menuEffects.clip = soundOnMoveOK;
        }
        else
        {
            menuController.menuEffects.clip = soundOnMoveFail;
        }
        leftArrow.startColorChange();

        inputDisabledTimer = delayAfterInput;

        menuController.menuEffects.Play();
    }
    public void damagePlayer(int x)
    {
        multiplier = 1;
        if (survival)
        {
            foreach (GameObject g in HelperFunctions.getChildren(GameObject.Find("MultiplierIndicator").transform))
            {
                g.transform.rotation = Quaternion.Euler(0, 0, 180);
                GraphicColorLerp gLerp = g.GetComponent <GraphicColorLerp>();
                gLerp.startColor = new Color(1, 0, 0, 1);
                gLerp.endColor   = new Color(1, 0, 0, 0);
                gLerp.startColorChange();
            }
        }
        if (!playerIsDead)
        {
            health -= x;
            StartCoroutine(cameraShake(screenShakeDuration, screenShakeMagnitude));
        }
        shield.startColor.a = Mathf.Lerp(0f, 1f, health * 1.0f / maxHealth);
        shield.startColorChange();
        HelperFunctions.playSound(ref shipAudio, shipHit);
        if (health * 1f / maxHealth < lowHealthThreshold)
        {
            if (!lowHealthText.enabled)
            {
                lowHealthText.enabled   = true;
                shipDangerAudio.enabled = true;
                HelperFunctions.playSound(ref shipDangerAudio, shipDanger);
            }
        }

        if (health <= 0)
        {
            playerIsDead            = true;
            lowHealthText.enabled   = false;
            shipDangerAudio.enabled = false;
            health = 0;
            HelperFunctions.playSound(ref shipAudio, shipDeath);
        }
    }
 public void changeMultiplier(int hits)
 {
     if (hits == 0)
     {
         if (multiplier != 1)    //do not display arrows if multiplier is already at 1.0x and player misses
         {
             GetComponent <AudioSource>().pitch = 1f;
             GetComponent <AudioSource>().PlayOneShot(multiplierDown, 1f);
             int temp = (int)(multiplier * 2 * missMultiplier);
             multiplier = (float)temp / 2;
             multiplier = (multiplier < 1 ? 1 : multiplier);
             foreach (GameObject g in HelperFunctions.getChildren(GameObject.Find("MultiplierIndicator").transform))
             {
                 g.transform.rotation = Quaternion.Euler(0, 0, 180);
                 GraphicColorLerp gLerp = g.GetComponent <GraphicColorLerp>();
                 gLerp.startColor = new Color(1, 0, 0, 1);
                 gLerp.endColor   = new Color(1, 0, 0, 0);
                 gLerp.startColorChange();
             }
         }
     }
     else if (hits > 1)
     {
         if (GetComponent <AudioSource>().pitch < 1.2f)
         {
             GetComponent <AudioSource>().pitch = GetComponent <AudioSource>().pitch + (multiplier * .025f);
         }
         GetComponent <AudioSource>().PlayOneShot(multiplierUp, 1f);
         multiplier += (hits - 1) * 0.5f;
         foreach (GameObject g in HelperFunctions.getChildren(GameObject.Find("MultiplierIndicator").transform))
         {
             g.transform.rotation = Quaternion.Euler(0, 0, 0);
             GraphicColorLerp gLerp = g.GetComponent <GraphicColorLerp>();
             gLerp.startColor = new Color(0, 1, 0, 1);
             gLerp.endColor   = new Color(0, 1, 0, 0);
             gLerp.startColorChange();
         }
     }
 }
Beispiel #15
0
    public void playButtonPress()
    {
        if (GameState.compareState(GameState.State.MainMenu))
        {
            GameState.setState(GameState.State.InGame);
            menuState = MenuState.None;
            GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerController>().setMovementState(1);

            playButton.gameObject.GetComponent <GraphicColorLerp>().startColorChange();
            levelSelectButton.gameObject.GetComponent <GraphicColorLerp>().startColorChange();
            creditsButton.gameObject.GetComponent <GraphicColorLerp>().startColorChange();
            quitButton.gameObject.GetComponent <GraphicColorLerp>().startColorChange();
            optionsButton.gameObject.GetComponent <GraphicColorLerp>().startColorChange();
            title.startColorChange();
            background.startColorChange();
            resetAllOutlines();
            eventSystem.SetSelectedGameObject(null);
            if (!debug)
            {
                Cursor.visible   = false;
                Cursor.lockState = CursorLockMode.Locked;
            }
        }
    }
Beispiel #16
0
 private IEnumerator textLoop(GraphicColorLerp colorLerp)
 {
     colorLerp.startColorChange();
     yield return(null);
 }
Beispiel #17
0
    private IEnumerator textLoop(Text textObject, GraphicColorLerp colorLerp, float initialDelay, float[] timers, int index)
    {
        while (initialDelay > 0)
        {
            if (Input.GetButtonDown("Submit"))
            {
                timers[0] = .1f;
                timers[1] = .1f;
                break;
            }
            initialDelay -= Time.deltaTime;
            yield return(null);
        }
        Color start = colorLerp.startColor;
        Color end   = colorLerp.endColor;

        while (true)
        {
            curIndex = cutSceneQueue.Dequeue();
            switch (curIndex.type)
            {
            case LetterEvent.Type.SENTENCE:
                //continue
                break;

            case LetterEvent.Type.EOL:
                loadNextScene();        //break out of scene
                yield break;
            }
            textObject.text      = curIndex.text;
            colorLerp.startColor = start;
            colorLerp.endColor   = end;
            colorLerp.startColorChange();
            yield return(null);

            timers[index] = holdDuration - gapBetweenSentences;
            while (timers[index] > 0)
            {
                if (Input.GetButtonDown("Submit"))
                {
                    timers[0] = .1f;
                    timers[1] = .1f;
                }
                timers[index] -= Time.deltaTime;
                yield return(null);
            }
            colorLerp.startColor = end;
            colorLerp.endColor   = start;
            colorLerp.startColorChange();
            yield return(null);

            timers[index] = holdDuration + gapBetweenSentences;
            while (timers[index] > 0)
            {
                if (Input.GetButtonDown("Submit"))
                {
                    timers[0] = .1f;
                    timers[1] = .1f;
                }
                timers[index] -= Time.deltaTime;
                yield return(null);
            }
        }
    }