コード例 #1
0
 protected void Awake()
 {
     ServerIdentifer.IsServer(isServer =>
     {
         if (isServer)
         {
             OnAwake();
         }
         else
         {
             if (type == BehaviourRemoveType.Selected)
             {
                 foreach (var b in ClientOnly)
                 {
                     Destroy(b);
                 }
             }
             if (type == BehaviourRemoveType.All)
             {
                 foreach (var b in GetComponents <MonoBehaviour>().Where(b => !NetworkImportant.Contains(b.GetType())))
                 {
                     Destroy(b);
                 }
             }
             if (type == BehaviourRemoveType.AllIncludeChilds)
             {
                 foreach (var b in GetComponentsInChildren <MonoBehaviour>().Where(b => !NetworkImportant.Contains(b.GetType())))
                 {
                     Destroy(b);
                 }
             }
             Destroy(this);
         }
     });
 }
コード例 #2
0
 protected void Awake()
 {
     ServerIdentifer.IsClient(isClient =>
     {
         if (isClient)
         {
             OnAwake();
         }
         else
         {
             if (type == BehaviourRemoveType.Selected)
             {
                 foreach (var b in ServerOnly)
                 {
                     Destroy(b);
                 }
             }
             if (type == BehaviourRemoveType.All)
             {
                 foreach (var b in GetComponents <MonoBehaviour>())
                 {
                     Destroy(b);
                 }
             }
             if (type == BehaviourRemoveType.AllIncludeChilds)
             {
                 foreach (var b in GetComponentsInChildren <MonoBehaviour>())
                 {
                     Destroy(b);
                 }
             }
             Destroy(this);
         }
     });
 }