Beispiel #1
0
        bool    FilterEntityNorm(CBaseEntity pEnt)
        {
            bool result = false;

            switch (m_eFilterType)
            {
            case EFilterType.ByName:
                result = pEnt.name.Equals(m_sTextComparator);
                break;

            case EFilterType.ByTag:
                result = pEnt.CompareTag(m_sTextComparator);
                break;

            case EFilterType.ByIsActive:
                result = pEnt.obj().activeInHierarchy;
                break;

            case EFilterType.ByIsVisible:
                Renderer pRenderer = pEnt.obj().GetComponent <Renderer>();
                if (pRenderer != null)
                {
                    result = pRenderer.enabled;
                }
                break;

            case EFilterType.ByIsSolid:
                Collider pCollider = pEnt.obj().GetComponent <Collider>();
                if (pCollider != null)
                {
                    result = pCollider.enabled;
                }
                break;

            case EFilterType.ByIsPhysicsSimulated:
                Rigidbody pBody = pEnt.obj().GetComponent <Rigidbody>();
                result = pBody != null;
                break;
            }

            return(result);
        }
Beispiel #2
0
 /**
  * Sets all entities to their default health and spawn flags.
  * Does this by calling Respawn() on all entities.
  */
 static void ReloadAllEntities()
 {
     for (int i = 0; i < g_aEntList.Count; i++)
     {
         CBaseEntity pEnt = g_aEntList[i];
         if (pEnt != null)
         {
             if (pEnt.HasFlag(FL_DESTROY_ON_RESPAWN))
             {
                 Destroy(pEnt.obj());
             }
             else
             {
                 pEnt.Respawn();
             }
         }
     }
 }