Exemple #1
0
    public override void OnTouchBegan()
    {
        Ray ray = Camera.main.ScreenPointToRay(InputController.GetTouchPosition());

        if (Physics.Raycast(ray, out hit))
        {
            if (hit.collider.gameObject == this.gameObject)
            {
                if (state == State.Peek)
                {
                    if (bug != null)                      // if there is a bug in the hide
                    {
                        state = State.Open;
                        eyes.GetComponent <SpriteRenderer>().enabled = false;
                        if (bug.GetComponent <Bug>() == null && Application.loadedLevelName == "ShyBugMenuMain")
                        {
                            bug.GetComponent <BugMenu>().reveal();                                                                                                            //MENU BUG
                        }
                        else
                        {
                            bug.GetComponent <Bug>().reveal();
                        }
                        inputBlocker.enableBlock(0.5f);
                        FMOD_StudioSystem.instance.PlayOneShot("event:/01_sfx/hide_bug", transform.position);
                        bug = null;
                        shake();
                        if (tutorialHand != null && tutorialHandRevealed)
                        {
                            tutorialHand.GetComponent <Revealer>().hider(0f);
                            tutorialHandRevealed = false;
                        }
                    }
                    else
                    {
                        inputBlocker.enableBlock(0.1f);                         // Blocks input
                        FMOD_StudioSystem.instance.PlayOneShot("event:/01_sfx/hide_empty", transform.position);
                        shake();
                    }
                }
                if (state == State.Closed)
                {
                    inputBlocker.enableBlock(0.1f);
                    shake();
                    FMOD_StudioSystem.instance.PlayOneShot("event:/01_sfx/hide", transform.position);
                    StartCoroutine(waitAndClose());
                    if (bug != null)
                    {
                        eyes.GetComponent <SpriteRenderer>().enabled = true;
                        if (tutorialHand != null && !tutorialHandRevealed)
                        {
                            tutorialHand.GetComponent <Revealer>().revealer(0f);
                            tutorialHandRevealed = true;
                        }
                    }
                    GetComponent <SpriteRenderer>().sprite = Open;
                    state = State.Peek;
                }
            }
        }
    }
Exemple #2
0
 public void fadeOut()
 {
     if (inputBlocker != null)
     {
         inputBlocker.enableBlock(0.5f);
     }
     image.enabled = true;
     LeanTween.value(gameObject, updateColor, transparent, Color.white, fadeSpeed).setEase(LeanTweenType.easeInOutSine);
 }
Exemple #3
0
    void Start()
    {
        //Debug.Log ("Tutorial");
        inputBlocker = GameObject.Find("InputBlocker").GetComponent <InputBlocker>();
        cam          = GameObject.Find("Main Camera");
        camPos       = GameObject.Find("CameraGamePosition");
        hides        = GameObject.FindGameObjectsWithTag("Hide");

        if (Application.loadedLevelName == "ShyBugLevel02")
        {
            inputBlocker.enableBlock(4f);
        }
        else if (Application.loadedLevelName == "ShyBugLevel01")
        {
            inputBlocker.enableBlock(2f);
            tutorialWindow = GameObject.Find("tutorialWindow");
        }

        for (int i = 0; i < hides.Length; i++)
        {
            hides [i].AddComponent <HideTutorial>();
        }
    }