Ejemplo n.º 1
0
    private void Awake()
    {
        mTarget = target as STSceneGroup;
        if (string.IsNullOrEmpty(mTarget.name))
        {
            mTarget.name = "STGroup";
        }
        for (int i = 0; i < 4; i++)
        {
            Assembly assembly = null;
            try
            {
                switch (i)
                {
                case 0:
                    assembly = Assembly.Load("Assembly-CSharp");
                    break;

                case 1:
                    assembly = Assembly.Load("Assembly-CSharp-firstpass");
                    break;

                case 2:
                    assembly = Assembly.Load("Assembly-UnityScript");
                    break;

                case 3:
                    assembly = Assembly.Load("Assembly-UnityScript-firstpass");
                    break;
                }
            }
            catch (Exception)
            {
                assembly = null;
            }
            if (assembly != null)
            {
                Type[] types = assembly.GetTypes();
                for (int j = 0; j < types.Length; j++)
                {
                    if (!types[j].IsAbstract)
                    {
                        if (types[j] == typeof(STSceneEntity) || types[j].IsSubclassOf(typeof(STSceneEntity)))
                        {
                            mEntityTypeList.Add(types[j]);
                        }
                    }
                }
            }
        }
    }
Ejemplo n.º 2
0
    public static STComponent AddSTComponentToGroup(STSceneGroup group, Type type)
    {
        GameObject go = new GameObject(type.ToString());

        go.transform.SetParent(group.transform);
        go.transform.localPosition = Vector3.zero;
        go.transform.localRotation = Quaternion.identity;
        go.transform.localScale    = Vector3.one;

        STComponent component = go.AddComponent(type) as STComponent;

        group.AddSTComponent(component);

        return(component);
    }
Ejemplo n.º 3
0
 public static T AddSTComponentToGroup <T>(STSceneGroup group) where T : STComponent
 {
     return(AddSTComponentToGroup(group, typeof(T)) as T);
 }