Ejemplo n.º 1
0
        float Difference(DungeonRoom room, DungeonRoom currentRoom, string type)
        {
            switch (type)
            {
            case "x":
                float xBottom = (room.Position.x + room.Size.x / 2) - (currentRoom.Position.x - currentRoom.Size.x / 2);
                float xTop    = (currentRoom.Position.x + currentRoom.Size.x / 2) - (room.Position.x - room.Size.x / 2);
                return(xBottom > 0 ? xBottom : xTop);

                break;

            case "z":
                float xRight = (room.Position.z + room.Size.z / 2) - (currentRoom.Position.z - currentRoom.Size.z / 2);
                float xLeft  = (currentRoom.Position.z + currentRoom.Size.z / 2) - (room.Position.z - room.Size.z / 2);
                return(xRight > 0 ? xRight : xLeft);

            default:
                return(0);

                break;
            }
        }
Ejemplo n.º 2
0
 public bool TooCloseTo(DungeonRoom room, DungeonRoom currentRoom)
 {
     return(currentRoom.Position.x + currentRoom.Size.x / 2 > room.Position.x - room.Size.x / 2 && currentRoom.Position.z + currentRoom.Size.z / 2 > room.Position.z - room.Size.z / 2 &&
            currentRoom.Position.x - currentRoom.Size.x / 2 < room.Position.x + room.Size.x / 2 && currentRoom.Position.z - currentRoom.Size.z / 2 < room.Position.z + room.Size.z / 2);
 }