Пример #1
0
    private void OnTriggerExit2D(Collider2D Other)
    {
        switch (Other.tag)
        {
        case "DoorTrigger":
            RoomsTransition.CloseDoor(Other);
            var    textTrigger = Other.GetComponent <Text>().text.Split('.');
            string locationName;
            if (Other.transform.position.y < GetComponent <Transform>().position.y)
            {
                locationName = textTrigger[0].Substring(9);
                StartCoroutine(RoomsTransition.HideAndShowHallway(locationName));
            }
            else
            {
                locationName = textTrigger[1].Substring(9);
            }

            StartCoroutine(RoomsTransition.MoovCamera(locationName));
            break;
        }

        animate = false;
        try
        {
            Destroy(hint);
        }
        catch { }
    }
Пример #2
0
    private void ActionTriggerStay(Collider2D Other)
    {
        switch (Other.tag)
        {
        case "DoorTrigger":
            RoomsTransition.OpenNearestDoor(Other);

            if (Other.transform.position.y < GetComponent <Transform>().position.y)
            {
                StartCoroutine(RoomsTransition.HideAndShowHallway(Other.GetComponent <Text>().text.Split('.')[1].Substring(9)));
            }
            break;

        case "MiniGameTrigger":
            StartCoroutine(RoomsTransition.MoovCamera("mini game"));
            GetComponent <Animator>().SetBool("Hight", true);
            var nearestMiniGame = RoomsTransition.Minigames[RoomsTransition.NearestObjectByTag(Other, RoomsTransition.Minigames)];
            nearestMiniGame.GetComponent <Animator>().SetBool("Show", true);
            MiniGameController.PlayMiniGame(nearestMiniGame);
            lockPlayerControl = !lockPlayerControl;
            break;

        default:
            var nameOfFather = Other.name;
            var father       = GameObject.Find(nameOfFather);
            var childsCount  = father.transform.GetChildCount();
            for (int i = 0; i < childsCount; i++)
            {
                var child = father.transform.GetChild(i);
                child.gameObject.SetActive(!child.gameObject.activeSelf);
            }
            break;
        }
    }
Пример #3
0
    IEnumerator Spawn()
    {
        yield return(new WaitForSeconds(1f));

        StartCoroutine(AllertController.ShowAllert(Allert, "Try to catch pasta"));
        yield return(new WaitForSeconds(3f));

        for (int i = 0; i < howMuchPasta; i++)
        {
            var spavnetPasta = Instantiate(pasta, catchPastaPanel.transform);
            spavnetPasta.transform.localPosition = new Vector3(Random.Range(-5, 6), 6f, -2f);
            yield return(new WaitForSeconds(1.5f));
        }

        if (catchedPasta > 0 && catchedPasta <= 5)
        {
            StartCoroutine(AllertController.ShowAllert(Allert, "Very bad, you can better"));
        }
        else if (catchedPasta > 5 && catchedPasta <= 10)
        {
            StartCoroutine(AllertController.ShowAllert(Allert, "Normal? but not very good"));
        }
        else if (catchedPasta > 10 && catchedPasta <= 15)
        {
            StartCoroutine(AllertController.ShowAllert(Allert, "Nice work"));
        }
        else
        {
            StartCoroutine(AllertController.ShowAllert(Allert, "Excelent! you`re amazing"));
        }

        yield return(new WaitForSeconds(3f));

        PlayerMoov.lockPlayerControl = !PlayerMoov.lockPlayerControl;
        StartCoroutine(RoomsTransition.MoovCamera("kitchen"));
        var player = FindObjectOfType <PlayerMoov>();

        GetComponent <Animator>().SetBool("Show", false);
        player.GetComponent <Animator>().SetBool("Hight", false);
    }