示例#1
0
    public void Teleport()
    {
        if (canTeleport | NextIndex == 4)
        {
            if (NextIndex != 0)
            {
                roomManager.Activate(NextIndex);
            }
            _player.transform.position = _exitPoint.position;
            canTeleport = false;
        }
        else
        {
            switch (NextIndex)
            {
            case 2:
                DialogueController.DialogueShow("The door is locked. Find the key under the blue flag", null);
                break;

            case 3:
                DialogueController.DialogueShow("To go further, you need to kill all the bugs!", null);
                break;
            }
        }
    }
示例#2
0
    public (RoomManager, Direction) Move(GameObject door)
    {
        Vector3Int doorCell = currentRoom.grid.WorldToCell(door.transform.position);
        Direction? doorDir  = null;

        if (doorCell.y >= currentRoom.Columns)
        {
            doorDir = Direction.East;
        }
        else if (doorCell.y <= 0)
        {
            doorDir = Direction.West;
        }
        else if (doorCell.x >= currentRoom.Rows)
        {
            doorDir = Direction.North;
        }
        else if (doorCell.x <= 0)
        {
            doorDir = Direction.South;
        }

        if (doorDir == null)
        {
            throw new Exception("That's not a door in this room.... where are you??");
        }

        currentRoom.Active = false;
        currentRoom        = currentRoom.neighbors[(Direction)doorDir];
        currentRoom.Activate();
        return(currentRoom, (Direction)doorDir);
    }