상속: ContainerObject, IMovableObject
예제 #1
0
        void Environment_ObjectAdded(MovableObject obj)
        {
            var item = obj as ItemObject;

            if (item == null)
                return;

            Debug.Assert(m_items.Contains(item) == false);

            m_items.Add(item);
        }
예제 #2
0
        void Environment_ObjectMoved(MovableObject ob, IntVector3 oldPos)
        {
            if (this.Area.Contains(oldPos) == false)
                return;

            var item = ob as ItemObject;

            if (item != null && item.StockpiledBy == this)
                item.StockpiledBy = null;
        }
예제 #3
0
 public static void AddGameEvent(MovableObject ob, string message)
 {
     AddGameEvent(ob.Environment, ob.Location, message);
 }
예제 #4
0
 protected virtual void ChildRemoved(MovableObject child)
 {
 }
예제 #5
0
 protected virtual void ChildAdded(MovableObject child)
 {
 }
예제 #6
0
 public void MoveChild(MovableObject ob, IntVector3 from, IntVector3 to)
 {
     ChildMoved(ob, from, to);
 }
예제 #7
0
 void OnObjectAddedOrRemoved(MovableObject ob)
 {
     m_invalid = true;
 }
예제 #8
0
 public void MoveChild(MovableObject ob, IntVector3 from, IntVector3 to)
 {
     ChildMoved(ob, from, to);
 }
예제 #9
0
 void OnObjectMoved(MovableObject ob, IntVector3 p)
 {
     m_invalid = true;
 }
예제 #10
0
 void OnObjectAddedOrRemoved(MovableObject ob)
 {
     m_invalid = true;
 }
예제 #11
0
 protected virtual void ChildMoved(MovableObject child, IntPoint3 from, IntPoint3 to)
 {
 }
예제 #12
0
 public void RemoveChild(MovableObject ob)
 {
     m_inventory.Remove(ob);
     ChildRemoved(ob);
 }
예제 #13
0
 public void MoveChild(MovableObject ob, IntPoint3 from, IntPoint3 to)
 {
     ChildMoved(ob, from, to);
 }
예제 #14
0
 public void AddChild(MovableObject ob)
 {
     m_inventory.Add(ob);
     ChildAdded(ob);
 }
예제 #15
0
        void Environment_ObjectMoved(MovableObject obj, IntPoint3 oldPos)
        {
            var item = obj as ItemObject;

            if (item == null)
                return;

            // nop for now
        }
예제 #16
0
 // called from object when its visual property changes
 internal void OnObjectVisualChanged(MovableObject ob)
 {
     if (MapTileObjectChanged != null)
         MapTileObjectChanged(ob, ob.Location, MapTileObjectChangeType.Update);
 }
예제 #17
0
 public void RemoveChild(MovableObject ob)
 {
     m_contents.Remove(ob);
     ChildRemoved(ob);
 }
예제 #18
0
        protected override void ChildAdded(MovableObject child)
        {
            IntPoint3 l = child.Location;

            List<MovableObject> obs;
            if (!m_objectMap.TryGetValue(l, out obs))
            {
                obs = new List<MovableObject>();
                m_objectMap[l] = obs;
            }

            Debug.Assert(!obs.Contains(child));

            if (child.IsLiving)
                obs.Insert(0, child);
            else
                obs.Add(child);

            if (MapTileObjectChanged != null)
                MapTileObjectChanged(child, l, MapTileObjectChangeType.Add);

            if (this.ObjectAdded != null)
                this.ObjectAdded(child);
        }
예제 #19
0
 void OnObjectMoved(MovableObject ob, IntVector3 p)
 {
     m_invalid = true;
 }
예제 #20
0
        protected override void ChildMoved(MovableObject child, IntPoint3 from, IntPoint3 to)
        {
            List<MovableObject> obs;

            /* first remove from the old position ... */

            Debug.Assert(m_objectMap.ContainsKey(from));

            obs = m_objectMap[from];

            bool removed = obs.Remove(child);
            Debug.Assert(removed);

            if (MapTileObjectChanged != null)
                MapTileObjectChanged(child, from, MapTileObjectChangeType.Remove);

            /* ... and then add to the new one */

            if (!m_objectMap.TryGetValue(to, out obs))
            {
                obs = new List<MovableObject>();
                m_objectMap[to] = obs;
            }

            Debug.Assert(!obs.Contains(child));

            if (child.IsLiving)
                obs.Insert(0, child);
            else
                obs.Add(child);

            if (MapTileObjectChanged != null)
                MapTileObjectChanged(child, to, MapTileObjectChangeType.Add);

            if (this.ObjectMoved != null)
                this.ObjectMoved(child, from);
        }
예제 #21
0
 public void AddChild(MovableObject ob)
 {
     m_contents.Add(ob);
     ChildAdded(ob);
 }
예제 #22
0
        protected override void ChildRemoved(MovableObject child)
        {
            IntPoint3 l = child.Location;

            Debug.Assert(m_objectMap.ContainsKey(l));

            List<MovableObject> obs = m_objectMap[l];

            bool removed = obs.Remove(child);
            Debug.Assert(removed);

            if (MapTileObjectChanged != null)
                MapTileObjectChanged(child, l, MapTileObjectChangeType.Remove);

            if (this.ObjectRemoved != null)
                this.ObjectRemoved(child);
        }
예제 #23
0
 public void RemoveChild(MovableObject ob)
 {
     m_contents.Remove(ob);
     ChildRemoved(ob);
 }
예제 #24
0
 protected virtual void ChildAdded(MovableObject child)
 {
 }
예제 #25
0
 protected virtual void ChildMoved(MovableObject child, IntVector3 from, IntVector3 to)
 {
 }
예제 #26
0
 protected virtual void ChildRemoved(MovableObject child)
 {
 }
예제 #27
0
 public static void AddGameEvent(MovableObject ob, string format, params object[] args)
 {
     AddGameEvent(ob.Environment, ob.Location, String.Format(format, args));
 }
예제 #28
0
 protected virtual void ChildMoved(MovableObject child, IntVector3 from, IntVector3 to)
 {
 }
예제 #29
0
 public void CameraMoveTo(MovableObject ob)
 {
     if (ob == null)
     {
         this.Environment = null;
     }
     else
     {
         var env = ob.Environment;
         CameraMoveTo(env, ob.Location);
     }
 }
예제 #30
0
 public void AddChild(MovableObject ob)
 {
     m_contents.Add(ob);
     ChildAdded(ob);
 }
예제 #31
0
        void Environment_ObjectRemoved(MovableObject ob)
        {
            if (this.Area.Contains(ob.Location) == false)
                return;

            var item = ob as ItemObject;

            if (item != null && item.StockpiledBy == this)
                item.StockpiledBy = null;
        }
예제 #32
0
        void Environment_ObjectRemoved(MovableObject obj)
        {
            var item = obj as ItemObject;

            if (item == null)
                return;

            Debug.Assert(m_items.Contains(item) == true);

            m_items.Remove(item);
        }