void Start()
 {
     menuController = GameObject.Find("MainMenuController").GetComponent <MenuController>();
     blackPanel     = GameObject.Find("BlackPanel").GetComponent <GraphicColorLerp>();
     eventSystem    = GameObject.Find("EventSystem").GetComponent <EventSystem>();
     levels         = getScollers(levelNumParent);
     levelIndex     = 0;
 }
예제 #2
0
 private void Awake()
 {
     colorLerp = GetComponent <GraphicColorLerp>();
     if (GameState.playTransition)       //This is the main reason why this is a script.  It will look to the GameState to tell if it should play on awake
     {
         playOnAwake = true;
     }
 }
 void Start()
 {
     text      = GetComponent <Text>();
     text.text = "Level " + (LevelNumber.getLevel() + 1);
     colorLerp = GetComponent <GraphicColorLerp>();
     if (!LoadedFromMenu)
     {
         StartCoroutine(displayText(1.5f));
     }
 }
예제 #4
0
 void Start()
 {
     cutSceneQueue = new List <string>()
     {
         "I got a letter in the mail today.", "I recognized the handwriting."
     };
     colorLerp1              = prompt1.gameObject.GetComponent <GraphicColorLerp>();
     colorLerp2              = prompt2.gameObject.GetComponent <GraphicColorLerp>();
     prompt1.text            = cutSceneQueue[0];
     prompt2.text            = cutSceneQueue[1];
     colorLerp1.duration     = 2f;
     colorLerp2.duration     = 2f;
     colorLerp2.initialDelay = 4f;
     StartCoroutine(textLoop(colorLerp1));
     StartCoroutine(textLoop(colorLerp2));
     StartCoroutine(textLoop(colorLerpBG));
     StartCoroutine(hideBothTexts(6f));
     StartCoroutine(endGame(15f));
 }
예제 #5
0
    void Start()
    {
        cutSceneQueue = new Queue <LetterEvent>(GameManager.narrativeQueue);
        colorLerp1    = prompt1.gameObject.GetComponent <GraphicColorLerp>();
        colorLerp2    = prompt2.gameObject.GetComponent <GraphicColorLerp>();
        timers        = new float[] { 0, 0 };
        StartCoroutine(textLoop(prompt1, colorLerp1, 0, timers, 0));
        StartCoroutine(textLoop(prompt2, colorLerp2, holdDuration, timers, 1));
        //cutSceneTitle.text = "Next Chapter";

        /*
         * switchPrompt = 1;
         *
         * narrativePrompt.text = " ";
         * narPrompt2.text = " ";
         *
         * //NarLength = " ";
         * if (cutSceneQueue.Count > 0)
         * {
         *  curIndex = cutSceneQueue.Dequeue();
         * }
         *
         * narrativePrompt.text = curIndex.text;
         *
         * flavorColorLerp = narrativePrompt.GetComponent<GraphicColorLerp>();
         *
         * //flavorColorLerp.startColorChange();
         * flavorColorLerp.duration = 1;
         *
         * flavorColorLerp2 = narPrompt2.GetComponent<GraphicColorLerp>();
         *
         * //flavorColorLerp2.startColorChange(); uncomment this to get second text fade in
         * flavorColorLerp2.initialDelay = 3;
         * flavorColorLerp2.duration = 1;
         *
         * if (cutSceneQueue.Count > 0)
         * {
         *  curIndex = cutSceneQueue.Dequeue();
         * }
         *
         * StartCoroutine(Example());
         */
    }
예제 #6
0
    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);
        }
    }
예제 #7
0
 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();
         }
     }
 }
예제 #8
0
    void Awake()
    {
        maxHealth    = health;
        settingsList = getSettings();
        blackPanel   = GameObject.Find("BlackPanel").GetComponent <GraphicColorLerp>();

        if (!survival)
        {
            levelNum = LevelNumber.getLevel();
        }
        setLevelSettings(levelNum);
        currentSettings       = settingsList[levelNum].GetComponentInChildren <GameSettings>();
        timeRemaining         = currentSettings.levelDuration;
        totalDuration         = timeRemaining;
        points                = 0;
        lowHealthText.enabled = false;
        bombs       = currentSettings.startingBombs;
        gameState   = GameState.beforeGame;
        eventSystem = GameObject.Find("EventSystem").GetComponent <EventSystem>();
        if (hideMouse)
        {
            Cursor.visible = false;
        }
    }
예제 #9
0
 void Start()
 {
     musicSource.clip      = menuMusic;
     skipIntro             = LevelNumber.getSkipIntro();
     blackPanel            = GameObject.Find("BlackPanel1").GetComponent <GraphicColorLerp>();
     levelSelectController = levelSelectCanvas.GetComponent <LevelSelectController>();
     mainCanvas.SetActive(false);
     levelSelectCanvas.SetActive(false);
     creditsCanvas.SetActive(false);
     if (skipIntro)
     {
         setMenuState((int)MenuState.main);
         GameObject.Find("MenuStarList").GetComponent <FTLJumpWithImage>().stopAllStars();
         LevelNumber.setSkipIntro(false);
     }
     else
     {
         setMenuState((int)MenuState.intro);
     }
     if (hideMouse)
     {
         Cursor.visible = false;
     }
 }
예제 #10
0
 private IEnumerator textLoop(GraphicColorLerp colorLerp)
 {
     colorLerp.startColorChange();
     yield return(null);
 }
예제 #11
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);
            }
        }
    }