Beispiel #1
0
    void Start()
    {
        clue.Set("Use the Arrow Keys to Move Your Character and press the Spacebar to Interact with Objects and find Clues. Hint: Go to the Piano for you're first clue. Once You Find All Nine Clues Interact with the White Spot Here.");
        clueBlock.Execute();

        string jsonFile = textFile.text;

        randFilm = UnityEngine.Random.Range(0, 2);

        text       = endText.GetComponent <Text>();
        text.color = new Color(text.color.r, text.color.g, text.color.b, 0f);

        end.Equals(4);

        numOfClues = 0;

        switch (randFilm)
        {
        case 0:
            randFil = 0;
            break;

        case 1:
            randFil = 9;
            break;

        case 2:
            randFil = 9;
            break;
        }

        Debug.Log(randFilm);

        clueReread = JsonHelper.FromJson <ClueObject>(jsonFile);
    }
        private IEnumerator AfterComplete()
        {
            float timer = 0;

            //yield return new WaitForSeconds(1+(winEffectDuration-1));

            do
            {
                yield return(new WaitForSeconds(0));

                timer         += Time.deltaTime;
                brightCG.alpha = 1 - timer;
            } while (brightCG.alpha > 0);


            if (targetPosOnWin)
            {
                StartCoroutine(GoToTargetPosition(timeToReachTarget));
            }
            else
            {
                afterWinBlock.Execute();
            }

            onWinAdittionalEvents.Invoke();
        }
Beispiel #3
0
        private void Update()
        {
            RaycastHit hit;

            if (Physics.Raycast(eye.position, eye.forward, out hit))
            {
                if (hit.collider == doorCol)
                {
                    gazeCounter += Time.deltaTime;
                }
                else
                {
                    gazeCounter = 0;
                }
            }
            else
            {
                gazeCounter = 0;
            }

            if (gazeCounter >= gazeTime)
            {
                runBlockWhenGazed.Execute();
                enabled = false;
            }
        }
        /// <summary>
        /// On shape completed event.
        /// </summary>
        private void OnShapeComplete()
        {
            //brightEffect.GetComponent<ParticleEmitter> ().emit = false;

            Animator shapeAnimator = shape.GetComponent <Animator> ();

            shapeAnimator.SetBool(shape.name, false);
            shapeAnimator.SetTrigger("Completed");

            //ShapesManager.Shape.StarsNumber collectedStars = Progress.instance.starsNumber;
            //AlphabetDataManager.SaveShapeStars(ShapesManager.Shape.selectedShapeID, collectedStars);

            //if (ShapesManager.Shape.selectedShapeID + 1 < ShapesManager.instance.shapes.Count)
            //{
            //AlphabetDataManager.SaveShapeLockedStatus (ShapesManager.Shape.selectedShapeID+ 1, false);
            //}

            List <Transform> paths = CommonUtil.FindChildrenByTag(shape.transform.Find("Paths"), "Path");
            int from, to;

            string [] slices;
            foreach (Transform p in paths)
            {
                slices = p.name.Split('-');
                from   = int.Parse(slices [1]);
                to     = int.Parse(slices [2]);
                AlphabetDataManager.SaveShapePathColor(ShapesManager.Shape.selectedShapeID, from, to, CommonUtil.FindChildByTag(p, "Fill").GetComponent <Image> ().color);
            }

            winParticles.Play();
            brightCG.alpha = 1;
            onWinImediateBlock.Execute();

            //StartCoroutine(AfterComplete());
        }
        private void Update()
        {
            var        curCounter = gazeCounter;
            RaycastHit hit;

            if (Physics.Raycast(eye.position, eye.forward, out hit))
            {
                if (hit.collider == doorCol)
                {
                    gazeCounter += Time.deltaTime;
                }
                else
                {
                    gazeCounter = 0;
                }
            }
            else
            {
                gazeCounter = 0;
            }

            if (gazeCounter >= gazeTime && curCounter <= gazeTime)
            {
                runBlockWhenGazed.Execute();
                fungusBoolHasGazed.Set(true);
            }
        }
    public void SetThisOption()
    {
        foreach (CorrelatedButtons cbt in correlatedOptions)
        {
            cbt.firstOption.interactable      = false;
            cbt.correlatedOption.interactable = true;

            cbt.correlatedOption.onClick.RemoveAllListeners();

            if (cbt != this)
            {
                cbt.correlatedOption.onClick.AddListener(delegate
                {
                    blockOnWrong.block.GetFlowchart().StopAllBlocks();
                    blockOnWrong.Execute(); Punch(cbt.correlatedOption);
                    ResetAllCorrelates();
                });
            }
            else
            {
                cbt.correlatedOption.onClick.AddListener(delegate
                {
                    blockOnRight.Execute();
                    Punch(cbt.correlatedOption);
                    correlatedOptions.Remove(cbt);
                    cbt.correlatedOption.interactable = false;
                    ResetAllCorrelates();
                });
            }
        }
    }
Beispiel #7
0
    private IEnumerator DelayTimer()
    {
        yield return(new WaitForSeconds(delay));

        onStartBlock.Execute();
        //onStartEvent.Invoke();
    }
Beispiel #8
0
    private IEnumerator WaitingForHint()
    {
        if (hinted)
        {
            yield break;
        }

        Animator currentHint;

        yield return(new WaitForSeconds(timeToHint));

        if (randomizeHint)
        {
            currentHint = _objectsToFind[Random.Range(0, _objectsToFind.Count)].hintAnimator;
            currentHint.SetTrigger("Hint");
        }
        else
        {
            foreach (FindableObject findObj in _objectsToFind)
            {
                findObj.hintAnimator.SetFloat("HintTime", 1 / hintSpeed);
                findObj.hintAnimator.SetTrigger("Hint");
            }
        }

        blockExecuteOnHint.Execute();
        hinted = true;
    }
    public void StartPage()
    {
        textIndex = 0;
        blockToExecute.Execute();

        if (gameContainer != null)
        {
            gameContainer.transform.SetParent(BookManager.instance.sysContainer.transform);
            gameContainer.GetComponent <RectTransform>().anchoredPosition3D = Vector3.zero;
        }
    }
Beispiel #10
0
    private void OnEnable()
    {
        foreach (SelectableOption sOpt in options)
        {
            sOpt.AutoSetup();

            if (audioOnClick != "")
            {
                sOpt.button.onClick.AddListener(delegate { AudioManager.instance.StopAllSounds(); AudioManager.instance.PlaySound(audioOnClick); });
            }

            if (playFailSounds && sOpt.response == SelectableOption.option.wrong)
            {
                sOpt.button.onClick.AddListener(delegate { PlayFailSound(); });
            }
            else if (sOpt.response == SelectableOption.option.right)
            {
                sOpt.button.onClick.AddListener(delegate {
                    rightOptionBlock.Execute();
                    DisableButtons();
                });
            }

            if (punchOnClick)
            {
                sOpt.button.onClick.AddListener(delegate { iTween.PunchScale(sOpt.button.gameObject, new Vector3(-0.15f, -0.15f, 0f), 1f); });
            }

            if (randomizeElements)
            {
                if (Random.Range(0f, 1f) < 0.5f)
                {
                    sOpt.button.transform.SetAsLastSibling();
                }
            }

            if (disabledOnEnter)
            {
                sOpt.button.interactable = false;
            }
            else
            {
                sOpt.button.interactable = true;
            }
        }
    }
Beispiel #11
0
    private void OnTriggerStay2D(Collider2D col)
    {
        if (Input.GetKeyDown("space"))
        {
            switch (col.gameObject.tag)
            {
            case "Piano":
                Debug.Log(col.gameObject.tag);

                clue.Set(clueReread[0 + randFil].clueText);
                clueBlock.Execute();

                numOfClues++;

                break;

            case "CreepChair":
                Debug.Log(col.gameObject.tag);

                clue.Set(clueReread[1 + randFil].clueText);
                clueBlock.Execute();

                numOfClues++;

                break;

            case "Coffin":
                Debug.Log(col.gameObject.tag);

                clue.Set(clueReread[2 + randFil].clueText);
                clueBlock.Execute();

                numOfClues++;

                break;

            case "Ciggies":
                Debug.Log(col.gameObject.tag);

                clue.Set(clueReread[3 + randFil].clueText);
                clueBlock.Execute();

                numOfClues++;

                break;

            case "Outside":
                Debug.Log(col.gameObject.tag);

                clue.Set(clueReread[4 + randFil].clueText);
                clueBlock.Execute();

                numOfClues++;

                break;

            case "Bed":
                Debug.Log(col.gameObject.tag);

                clue.Set(clueReread[5 + randFil].clueText);
                clueBlock.Execute();

                numOfClues++;

                break;

            case "Bath":
                Debug.Log(col.gameObject.tag);

                clue.Set(clueReread[6 + randFil].clueText);
                clueBlock.Execute();

                numOfClues++;

                break;

            case "Dining":
                Debug.Log(col.gameObject.tag);

                clue.Set(clueReread[7 + randFil].clueText);
                clueBlock.Execute();

                numOfClues++;

                break;

            case "Kitchen":
                Debug.Log(col.gameObject.tag);

                clue.Set(clueReread[8 + randFil].clueText);
                clueBlock.Execute();

                numOfClues++;

                break;

            case "End":
                if (numOfClues >= 6)
                {
                    Debug.Log("Ending Sequence Started");

                    endBlock.Execute();
                }

                break;
            }
        }
    }
 public void DisablePage()
 {
     cgc.EnableCanvasGroup(false);
     ResetPage();
     onOutBlock.Execute();
 }