예제 #1
0
    private void DestroyComponents(Type t, GameObject go, bool client, bool server)
    {
        List <Component> components = new List <Component>();

        PrefabPreProcess.FindComponents(go.transform, components, t);
        components.Reverse();
        foreach (Component component in components)
        {
            RealmedRemove realmedRemove = component.GetComponent <RealmedRemove>();
            if (realmedRemove != null && !realmedRemove.ShouldDelete(component, client, server))
            {
                continue;
            }
            if (!component.gameObject.CompareTag("persist"))
            {
                this.NominateForDeletion(component.gameObject);
            }
            UnityEngine.Object.DestroyImmediate(component, true);
        }
    }
예제 #2
0
    private void DestroyComponents(System.Type t, GameObject go, bool client, bool server)
    {
        List <Component> list = new List <Component>();

        PrefabPreProcess.FindComponents(go.get_transform(), list, t);
        list.Reverse();
        using (List <Component> .Enumerator enumerator = list.GetEnumerator())
        {
            while (enumerator.MoveNext())
            {
                Component     current   = enumerator.Current;
                RealmedRemove component = (RealmedRemove)current.GetComponent <RealmedRemove>();
                if (!Object.op_Inequality((Object)component, (Object)null) || component.ShouldDelete(current, client, server))
                {
                    if (!current.get_gameObject().CompareTag("persist"))
                    {
                        this.NominateForDeletion(current.get_gameObject());
                    }
                    Object.DestroyImmediate((Object)current, true);
                }
            }
        }
    }