Ejemplo n.º 1
0
 private void AddSyncBaseToDatabase(SyncBase syncBase)
 {
     Database[syncBase.ID] = syncBase;
     if (Server.IsRunning())
     {
         Type Type = syncBase.GetType();
         if (!CategorizedDatabase.ContainsKey(Type))
         {
             CategorizedDatabase.Add(Type, new List <int>());
             SyncHandletypes.Add(Type, syncBase.GetSyncHandletype());
         }
         CategorizedDatabase[Type].Add(syncBase.ID);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Clears the given gameobject's <see cref="SyncBase"/>s from the Database.
 /// </summary>
 /// <param name="gameObject">The GameObject to remove.</param>
 public void RemoveEntity(GameObject gameObject)
 {
     for (int i = 0; i < SyncableClasses.Length; i++)
     {
         SyncBase Syncable = (SyncBase)gameObject.GetComponent(SyncableClasses[i]);
         if (Syncable != null)
         {
             Database.Remove(Syncable.ID);
             if (Server.IsRunning())
             {
                 CategorizedDatabase[Syncable.GetType()].RemoveAll(x => x == Syncable.ID);
             }
         }
     }
 }