protected void RaiseUpdateEvents()
        {
            foreach (IAgentView agentView in this.GetAgentViews())
            {
                agentView.OnAgentUpdated();
            }
            PhysicalAgent physicalAgent = this.Parent as PhysicalAgent;

            if (physicalAgent == null || !(this is Item))
            {
                return;
            }
            foreach (IAgentView agentView in physicalAgent.GetAgentViews())
            {
                IContainerView containerView = agentView as IContainerView;
                if (containerView != null)
                {
                    containerView.OnChildUpdated((Item)this);
                }
            }
        }
Exemple #2
0
 public static void Update(PhysicalAgent agent)
 {
     if (!Map.m_Locked)
     {
         AgentCell agentCell = agent.AcquireViewportCell();
         agentCell.Update();
         ArrayList owner     = agentCell.Owner;
         ArrayList arrayList = agent.InWorld ? Map.GetList(agent.X, agent.Y) : (ArrayList)null;
         if (arrayList != owner)
         {
             if (owner != null)
             {
                 owner.Remove((object)agentCell);
             }
             if (arrayList != null)
             {
                 int index = arrayList.BinarySearch((object)agentCell, TileSorter.Comparer);
                 if (index < 0)
                 {
                     index = ~index;
                 }
                 arrayList.Insert(index, (object)agentCell);
             }
             agentCell.Owner = arrayList;
         }
         else
         {
             if (arrayList == null)
             {
                 return;
             }
             arrayList.Sort(TileSorter.Comparer);
         }
     }
     else
     {
         Map.m_LockQueue.Enqueue((object)new UpdateAgentLock(agent));
     }
 }
Exemple #3
0
 public AgentCell(PhysicalAgent agent)
 {
     this._agent = agent;
 }