Beispiel #1
0
    private IEnumerator FlashMessage(string message, int numTimes, float fadeIntime, float persistTime, float fadeOutTime)
    {
        displaying = true;
        text.StopAllCoroutines();               // stop any previous crossFadeAlpha in progress
        text.text = message;
        while (numTimes > 0)
        {
            text.canvasRenderer.SetAlpha(0);
            text.CrossFadeAlpha(1, fadeIntime, true);
            yield return(new WaitForSecondsRealtime(fadeIntime));

            text.canvasRenderer.SetAlpha(1);
            if (OnFlashMessage != null)
            {
                OnFlashMessage();
            }
            yield return(new WaitForSecondsRealtime(persistTime));

            text.CrossFadeAlpha(0, fadeOutTime, true);                  // fade out

            yield return(new WaitForSecondsRealtime(fadeOutTime + 0.1f));

            numTimes--;
        }
        displaying     = false;
        OnFlashMessage = null;
    }
Beispiel #2
0
    void Start()
    {
        BackgroundPanel = Background.GetComponent <CanvasGroup>();
        Background.CrossFadeAlpha(0, 0, true);
        Text.CrossFadeAlpha(0, 0, true);

        AudioListener.volume = Volume;

        ShowExistTutorial();
    }
Beispiel #3
0
 // Start is called before the first frame update
 void Awake()
 {
     DialogTexts = GetComponentsInChildren <TMP_Text>();
     foreach (TMP_Text item in DialogTexts)
     {
         item.CrossFadeAlpha(0f, 0.001f, false);
     }
     TitleText.CrossFadeAlpha(0, 0.001f, false);
     SubText.CrossFadeAlpha(0, 0.001f, false);
 }
Beispiel #4
0
 // Update is called once per frame
 void Update()
 {
     if (Data.msgNew)
     {
         msg.text = Data.msg;
         msg.CrossFadeAlpha(1, 0, true);
         StopCoroutine(MsgErase());
         StartCoroutine(MsgErase());
         Data.msgNew = false;
     }
 }
Beispiel #5
0
    public void SetBuffDisplay(BuffType type, bool On, float FadeTime = 1f)
    {
        float alphaValue = On ? 1f : 0;

        switch (type)
        {
        case BuffType.ArmourIncrease:
            _buffArmourSlot.CrossFadeAlpha(alphaValue, FadeTime, false);  //Icono.
            _buffArmor.CrossFadeAlpha(alphaValue, FadeTime, false);       //Texto.
            break;

        case BuffType.DamageIncrease:
            _buffDamageSlot.CrossFadeAlpha(alphaValue, FadeTime, false);    //Icono.
            _buffDamage.CrossFadeAlpha(alphaValue, FadeTime, false);        //Texto.
            break;

        case BuffType.CardCostDecrease:
            //Falta implementar.
            break;

        case BuffType.NullyfyCardCost:
            //Falta implementar.
            break;

        case BuffType.Invulnerability:
            //Falta implementar.
            break;

        default:
            break;
        }
    }
Beispiel #6
0
    private void OnTriggerStay(Collider playerTrigg)
    {
        if (playerTrigg.CompareTag("Player"))
        {
            powerNeededToOpenDoorText.gameObject.SetActive(true);
            powerNeededToOpenDoorText.CrossFadeAlpha(0, 6, false);

            if (allPowerGained.gameObject.activeInHierarchy)
            {
                doorCol.gameObject.SetActive(false);
                press_E_ToOpenDoor.gameObject.SetActive(true);

                if (Input.GetKeyDown(KeyCode.E))
                {
                    opendBossDoorText.gameObject.SetActive(true);
                    opendBossDoorText.CrossFadeAlpha(0, 4, false);

                    bossDoorLeft.Play("BossDoorLeftOpen");
                    bossDoorRight.Play("BossDoorRightOpen");

                    psDoor.gameObject.SetActive(false);
                    press_E_ToOpenDoor.gameObject.SetActive(false);
                    this.gameObject.SetActive(false);

                    AudioSource.PlayClipAtPoint(doorActivate, cameraPos.transform.position);
                }
            }
        }
    }
Beispiel #7
0
    private IEnumerator FadeOut()
    {
        tmp.CrossFadeAlpha(0.0f, 3.0f, false);
        yield return(new WaitForSeconds(3.0f));

        gameObject.SetActive(false);
    }
Beispiel #8
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.CompareTag("Player"))
     {
         disruptedRitualText.gameObject.SetActive(true);
         disruptedRitualText.CrossFadeAlpha(0, 4, false);
         Invoke("WaitTime", 4);
     }
 }
Beispiel #9
0
    // Start is called before the first frame update
    void Start()
    {
        if (fIn == true)
        {
        }
        if (fIn == false)
        {
            dialogue.SetActive(true);
            urucurea = 1;

            fadeImg.canvasRenderer.SetAlpha(1.0f);
            text.canvasRenderer.SetAlpha(1.0f);

            fadeImg.CrossFadeAlpha(0, 20, false);
            text.CrossFadeAlpha(0, 20, false);
            textEN.CrossFadeAlpha(0, 20, false);
            textES.CrossFadeAlpha(0, 20, false);
        }
    }
    // When player collides with key, picks up key, adds image to UI, text showing picked up key
    void OnTriggerEnter(Collider playerTrigg)
    {
        if (playerTrigg.gameObject.tag == "Player")
        {
            keyPickUpImage1.transform.gameObject.SetActive(true);
            Destroy(gameObject);

            keyPicktext.gameObject.SetActive(true);
            keyPicktext.CrossFadeAlpha(0, 2, false);  // fading the alpha out of the text to zero
            AudioSource.PlayClipAtPoint(pickUpSound, cameraPos.transform.position);
        }
    }
Beispiel #11
0
    // Instantiates & Projects Magic Ball prefab
    void FireMagicBall()
    {
        if (mana > 0)
        {
            mana            -= currentMana = magicManaCost;
            manaSlider.value = mana;

            if (Input.GetKeyDown(KeyCode.Mouse0))
            {
                animator.SetTrigger("canShootMagic");
            }
            else
            {
                animator.SetBool("resetShootMagic", false);
            }
        }
        else if (mana <= 0)
        {
            Invoke("noManaclick", noManaTextTimer);
            notEnoughMana.CrossFadeAlpha(1, 3, true);
        }
    }
Beispiel #12
0
    // When player collides with powergain, gains more power, adds image to UI, text showing picked up power
    void OnTriggerEnter(Collider playerTrigg)
    {
        if (playerTrigg.gameObject.tag == "Player")
        {
            PowerGainPickUpImg1.gameObject.SetActive(true);
            Destroy(gameObject);

            PowerGainText.gameObject.SetActive(true);
            PowerGainText.CrossFadeAlpha(0, 3, false);  // fading the alpha out of the text to zero

            PowerRingsGainText1.gameObject.SetActive(true);
            AudioSource.PlayClipAtPoint(pickUpSound, cameraPos.transform.position);
        }
    }
Beispiel #13
0
    // trigger player stop while text appears...
    private void OnTriggerStay(Collider other)
    {
        if (other.tag == "Player")
        {
            _PlayerMov.enabled   = false;
            _PlayerMagic.enabled = false;
            playerAnimFreeze.GetComponent <Animator>().enabled = false;


            Invoke("PlayerStatic", staticTime);

            textProAnim.gameObject.SetActive(true);
            textProAnim.CrossFadeAlpha(0, 5.0f, false);

            AudioSource.PlayClipAtPoint(portalSound, cameraPos.transform.position, 0.8f);
        }
    }
Beispiel #14
0
 // When player picks up the key and is in range/collides with collider then display text ""press E to open door/animation door open
 void OnTriggerStay(Collider col)
 {
     if (col.tag == "Player" && _KeyScript.keyPickUpImage1.transform.gameObject.activeInHierarchy)
     {
         openDoorText.gameObject.SetActive(true);
     }
     if (Input.GetKeyDown(KeyCode.E) && _KeyScript.keyPickUpImage1.transform.gameObject.activeInHierarchy) // press e to open the door once the player has the key
     {
         doorAnim.Play("DoorOpeningSlide");
         _KeyScript.keyPickUpImage1.gameObject.SetActive(false);
         doorAccessGranted.gameObject.SetActive(true);
         doorAccessGranted.CrossFadeAlpha(0, 3, false);
         doorIsLocked.gameObject.SetActive(false);
         AudioSource.PlayClipAtPoint(activateSound, cameraPos.transform.position);
     }
     else if (col.tag == "Player")
     {
         doorIsLocked.gameObject.SetActive(true);
     }
 }
    public void OnTriggerStay(Collider playerTrigg)
    {
        if (playerTrigg.tag == "Player")
        {
            activateLeverText.gameObject.SetActive(true);

            if (Input.GetKeyDown(KeyCode.E))
            {
                animLevelPull.Play("LevelPullActivate");
                bridge.gameObject.SetActive(true);

                activateLeverText.CrossFadeAlpha(0, 1, false);

                leverActivatedText.gameObject.SetActive(true);
                leverActivatedText.CrossFadeAlpha(0, 2, false);

                AudioSource.PlayClipAtPoint(leverActivateSound, cameraPos.transform.position);
            }
        }
    }
    private void OnTriggerStay(Collider other)
    {
        if (other.CompareTag("Player"))
        {
            pressE_PickUpText.gameObject.SetActive(true);

            if (Input.GetKeyDown(KeyCode.E))
            {
                RestOfPowerGainedText.gameObject.SetActive(true);
                RestOfPowerGainedText.CrossFadeAlpha(0, 4, false);

                powerRingimg3.gameObject.SetActive(true);
                powerGained_3_Text.gameObject.SetActive(true);

                powerGained_2_Text.gameObject.SetActive(false);

                pressE_PickUpText.gameObject.SetActive(false);

                Destroy(gameObject);

                AudioSource.PlayClipAtPoint(pickUpSound, cameraPos.transform.position);
            }
        }
    }
Beispiel #17
0
    public void NewLine()
    {
        if (DialogIndex < DialogTexts.Length)
        {
            if (DialogIndex >= 1)
            {
                TMP_Text previousLine = DialogTexts[DialogIndex - 1];
                previousLine.CrossFadeAlpha(0.5f, 0.1f, true);
            }
            if (DialogIndex >= 2)
            {
                TMP_Text oldLine = DialogTexts[DialogIndex - 2];

                oldLine.CrossFadeAlpha(0f, 0.1f, true);
            }
            if (DialogIndex > 0)
            {
                Vector3 currentPosition = transform.position;
                Vector3 nextPosition    = new Vector3(currentPosition.x, currentPosition.y + textShift, currentPosition.z);
                transform.position = nextPosition;
            }

            DialogTexts[DialogIndex].CrossFadeAlpha(1, 0.1f, true);
            DialogIndex++;
        }
        else
        {
            if (DialogIndex > 1)
            {
                DialogTexts[DialogIndex - 1].CrossFadeAlpha(0, 0.2f, true);
                DialogTexts[DialogIndex - 2].CrossFadeAlpha(0, 0.1f, true);
            }

            GameObject.Find("SceneHolder").GetComponent <Animator>().SetTrigger("Trigger_End");
        }
    }
Beispiel #18
0
 private void Awake()
 {
     youThoughtYouWereSafe.gameObject.SetActive(true);
     youThoughtYouWereSafe.CrossFadeAlpha(0, 5, false);
 }
Beispiel #19
0
 private void AnimateFade(float toAlpha, float time)
 {
     messageText.CrossFadeAlpha(toAlpha, time, false);
     stackText.CrossFadeAlpha(toAlpha, time, false);
     stackImage.CrossFadeAlpha(toAlpha, time, false);
 }