示例#1
0
 void Start()
 {
     //currentLanguage = MessagesFairy.LANGUAGE.English;
     prevSongId = -1;
     SetWaitAFrame(false);
     SetCheckMainMenu(false);
     setSpawnPoint = false;
     MessagesFairy.StartMessages();
     //Pongo esta condicion para ver si estamos en el menu principal
     //si no me machacaba la cancion.
     if (FindObjectOfType <MenuLogic>() == null)
     {
         changeWorldClip = Resources.Load <AudioClip>("Sounds/ChangeWorld");
         gameObject.GetComponent <AudioSource>().clip = changeWorldClip;
     }
 }
示例#2
0
    // Update is called once per frame
    void Update()
    {
        if (GameLogic.instance != null)
        {
            if (GameLogic.instance.showTimeCounter)
            {
                if (timeFeedBackObject != null)
                {
                    timeFeedBackObject.SetActive(true);
                    timeFeedBackObject.GetComponent <Text>().text = (Mathf.Floor((GameLogic.instance.timeElapsed))).ToString() + "s";
                }
            }
            else
            {
                if (timeFeedBackObject != null)
                {
                    timeFeedBackObject.SetActive(false);
                }
            }


            //CheckNull();
            CheckPause();
            if (InputManager.instance.resetButton)
            {
                Barra.SetActive(true);
            }
            else
            {
                Barra.SetActive(false);
            }

            if (sequenceIndex > -1 && (GameLogic.instance.eventState == GameLogic.EventState.TEXT))
            {
                Debug.Log(sequenceIndex);
                List <Sprite> animation;
                if (!InputManager.gamePadConnected)
                {
                    animation = MessagesFairy.GetSpriteList(sequenceIndex, 0);
                }
                else
                {
                    animation = MessagesFairy.GetSpriteList(sequenceIndex, 1);
                }

                if (animation != null)
                {
                    Debug.Log("Count = " + animation.Count);
                    Debug.Log("Frame = " + currentFrame);

                    if (!fairyImage.isActiveAndEnabled)
                    {
                        fairyImage.enabled = true;
                        fairyImage.sprite  = animation[currentFrame];
                        //fairyImage.gameObject.SetActive(true);
                    }
                    else
                    {
                        if (timer > 0.3f)
                        {
                            currentFrame++;

                            if (currentFrame >= animation.Count)
                            {
                                currentFrame = 0;
                            }
                            fairyImage.sprite = animation[currentFrame];

                            timer = 0;
                        }
                        timer += Time.deltaTime;
                    }
                }
            }
            else
            {
                currentFrame       = 0;
                fairyImage.enabled = false;
                //fairyImage.gameObject.SetActive(false);
            }

            if (GameLogic.instance.eventState == GameLogic.EventState.TEXT)
            {
                fairyTextObject.SetActive(true);

                if (textIndex > -1)
                {
                    if (InputManager.gamePadConnected)
                    {
                        fairyText.text = MessagesFairy.GetMessage(textIndex, 1, GameLogic.instance.currentLanguage);
                    }
                    else
                    {
                        fairyText.text = MessagesFairy.GetMessage(textIndex, 0, GameLogic.instance.currentLanguage);
                    }
                }
                else
                {
                    if (!InputManager.gamePadConnected && MessagesFairy.asked)
                    {
                        Debug.Log("AskedForAdvice");
                        fairyText.text = MessagesFairy.GetAdvice(0, GameLogic.instance.currentLanguage);
                    }
                    else if (MessagesFairy.asked)
                    {
                        fairyText.text = MessagesFairy.GetAdvice(1, GameLogic.instance.currentLanguage);
                    }
                }
            }
            else
            {
                fairyTextObject.SetActive(false);

                if (GameLogic.instance.eventState == GameLogic.EventState.IMAGE)
                {
                }
            }
        }
    }