Beispiel #1
0
        public void RegisterObject(WorldObject worldObject)
        {
            if (worldObject == null)
            {
                throw new ArgumentNullException("worldObject");
            }
            if (worldObject.Sector != null)
            {
                throw new ArgumentException("Given object is already registered somewhere.", "worldObject");
            }
            if (!BoundingBox.Intersects(boundary, worldObject.WorldBoundary))
            {
                throw new ArgumentException("Given object is not in volume of the sector.", "worldObject");
            }

            if (manager != null)
            {
                manager.RegisterObject(worldObject);
            }

            registeredObjects.Add(worldObject);
            ReallyRegisterObject(worldObject);
            worldObject.Sector = this;
            worldObject.TransformationChanged += worldObject_TransformationChanged;
        }
Beispiel #2
0
        internal void RegisterObject(WorldObject worldObject)
        {
            Debug.Assert(worldObject != null);

            if (registeredObjects.Contains(worldObject.Name))
            {
                throw new ArgumentException("Object with name '" + worldObject.Name + "' is already registered.",
                                            "worldObject");
            }

            registeredObjects.Add(worldObject);
            worldObject.TransformationChanged += worldObject_TransformationChanged;
        }