Example #1
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;
        }
    }
Example #2
0
    private int GetTextHint(Collider2D Other)
    {
        int index = 0;

        switch (Other.tag)
        {
        case "DoorTrigger":
            if (RoomsTransition.Doors[RoomsTransition.NearestObjectByTag(Other, RoomsTransition.Doors)].tag == "Face")
            {
                if (Other.transform.position.y > GetComponent <Transform>().position.y)
                {
                    index = 0;
                }
                else
                {
                    index = 1;
                }
            }
            else if (RoomsTransition.Doors[RoomsTransition.NearestObjectByTag(Other, RoomsTransition.Doors)].tag == "From side")
            {
                if (Other.transform.position.x < GetComponent <Transform>().position.x)
                {
                    index = 0;
                }
                else
                {
                    index = 1;
                }
            }
            break;

        case "MiniGameTrigger":
            index = 0;
            break;
        }
        ;
        return(index);
    }