示例#1
0
    private static PhysicalSupportTools AddSupportTools(GameObject o, PhysicalSupportType supportType, IPhysicalSupport support)
    {
        PhysicalSupportTools ps = o.GetComponent <PhysicalSupportTools>();

        if (!ps || ps.m_SupportType != supportType)
        {
            ps = o.AddComponent <PhysicalSupportTools>();
            ps.m_SupportType = supportType;
        }
        ps.m_Support = support;
        return(ps);
    }
示例#2
0
 public static void Remove(GameObject o, PhysicalSupportType supportType)
 {
     PhysicalSupportTools[] pss = o.GetComponents <PhysicalSupportTools>();
     if (pss != null || pss.Length != 0)
     {
         for (int i = 0, length = pss.Length; i < length; i++)
         {
             if (pss[i].m_SupportType == supportType)
             {
                 Destroy(pss[i]);
             }
         }
     }
 }
 private static PhysicalSupportTools AddSupportTools(GameObject o, PhysicalSupportType supportType, IPhysicalSupport support)
 {
     PhysicalSupportTools ps = o.GetComponent<PhysicalSupportTools>();
     if (!ps || ps.m_SupportType != supportType)
     {
         ps = o.AddComponent<PhysicalSupportTools>();
         ps.m_SupportType = supportType;
     }
     ps.m_Support = support;
     return ps;
 }
 public static void Remove(GameObject o, PhysicalSupportType supportType)
 {
     PhysicalSupportTools[] pss = o.GetComponents<PhysicalSupportTools>();
     if(pss != null || pss.Length != 0)
     {
         for(int i = 0, length = pss.Length ; i < length; i++)
         {
             if (pss[i].m_SupportType == supportType)
                 Destroy(pss[i]);
         }
     }
 }