Ejemplo n.º 1
0
    void handleVerticalInput()
    {
        //Enter doors
        if (MyInput.GetEnterDoor())
        {
            Player_EnterDoors[] doors = FindObjectsOfType <Player_EnterDoors>();
            for (int i = 0; i < doors.Length; i++)
            {
                Transform child = doors[i].transform;
                if (GetComponent <BoxCollider2D>().OverlapPoint(new Vector2(child.Find("EntrancePoint").position.x, child.Find("EntrancePoint").position.y)) && doors[i].isOpen)
                {
                    doors[i].changeRoom();
                    break;
                }
            }
        }

        /*
         * //Open chests
         * if (Input.GetAxis("Vertical") < 0.1)
         * {
         *  List<Transform> cases = roomManager.GetActiveCases();
         *  for (int i = 0; i < cases.Count; i++)
         *  {
         *      Transform child = cases[i];
         *      Debug.Log("[Player_Movement] Found a case in " + child.parent.parent.gameObject.name);
         *      if (GetComponent<BoxCollider2D>().OverlapPoint(new Vector2(child.Find("OpeningPoint").position.x, child.Find("OpeningPoint").position.y)))
         *      {
         *          child.GetComponent<Case_Open>().Open();
         *          Debug.Log("[Player_Movement] Tried to open a case in " + child.parent.parent.gameObject.name);
         *          break;
         *      }
         *  }
         *
         *  List<Transform> items = roomManager.GetActiveItems();
         *  for (int i = 0; i < items.Count; i++)
         *  {
         *      Transform child = items[i];
         *      Debug.Log("[Player_Movement] Found an item in " + child.parent.parent.gameObject.name);
         *      if (GetComponent<BoxCollider2D>().OverlapPoint(new Vector2(child.Find("PickUpPoint").position.x, child.Find("PickUpPoint").position.y)))
         *      {
         *          child.GetComponent<Item_SuperClass>().OnPickUp();
         *          Debug.Log("[Player_Movement] Tried to pick up an item in " + child.parent.parent.gameObject.name);
         *          break;
         *      }
         *  }
         * }*/
    }