Esempio n. 1
0
 public bool IsPointIn(Vector3 dot)
 {
     return dot.IsBetween(BBMin, BBMax);
 }
Esempio n. 2
0
        public static Room FindPosCogerrence(Vector3 newPos, Room room)
        {
            if(room == null)
            {
                return EngineWorld.FindRoomByPosition(newPos);
            }

            if (room.Active && newPos.X.IsBetween(room.BBMin.X, room.BBMax.X, IB.aIbE) &&
                newPos.Y.IsBetween(room.BBMin.Y, room.BBMax.Y, IB.aIbE))
            {
                if(newPos.Z.IsBetween(room.BBMin.Z, room.BBMax.Z, IB.aIbE))
                {
                    return room;
                }
                else if(newPos.Z >= room.BBMax.Z)
                {
                    var origSector = room.GetSectorRaw(newPos);
                    if(origSector.SectorAbove != null)
                    {
                        return origSector.SectorAbove.OwnerRoom.CheckFlip();
                    }
                }
                else if (newPos.Z < room.BBMin.Z)
                {
                    var origSector = room.GetSectorRaw(newPos);
                    if (origSector.SectorBelow != null)
                    {
                        return origSector.SectorBelow.OwnerRoom.CheckFlip();
                    }
                }
            }

            var newSector = room.GetSectorRaw(newPos);
            if(newSector != null && newSector.PortalToRoom >= 0)
            {
                return EngineWorld.Rooms[newSector.PortalToRoom].CheckFlip();
            }

            foreach (var r in room.NearRoomList)
            {
                if(r.Active && newPos.IsBetween(r.BBMin, r.BBMax, IB.aIbE))
                {
                    return r;
                }
            }

            return EngineWorld.FindRoomByPosition(newPos);
        }
Esempio n. 3
0
 public Room FindRoomByPosition(Vector3 pos)
 {
     return Rooms.FirstOrDefault(r => r.Active && pos.IsBetween(r.BBMin, r.BBMax, IB.aIbE));
 }