示例#1
0
        /// <summary>
        /// 系统初始化
        /// </summary>
        public virtual void OnStart()
        {
            IsEnabled = true;
            StarComponentAttribute sca = GetType().GetCustomAttribute <StarComponentAttribute>();

            StarComponents = sca != null ? sca.StarComponents : null;
            StarEntities   = new HashSet <ECS_Entity>();

#if UNITY_EDITOR
            SystemNameAttribute mna = GetType().GetCustomAttribute <SystemNameAttribute>();
            Name = string.Format("{0} ({1})", mna != null ? mna.Name : "未命名", GetType().FullName);
#endif
        }
            public ECS_SystemInfo(Type type, Dictionary <Type, ECS_ComponentInfo> components)
            {
                SystemNameAttribute mna = type.GetCustomAttribute <SystemNameAttribute>();

                Name           = string.Format("{0} ({1})", mna != null ? mna.Name : "未命名", type.FullName);
                SystemType     = type;
                StarComponents = new List <ECS_ComponentInfo>();
                StarComponentAttribute sca = type.GetCustomAttribute <StarComponentAttribute>();

                if (sca != null && sca.StarComponents != null)
                {
                    for (int i = 0; i < sca.StarComponents.Length; i++)
                    {
                        StarComponents.Add(components[sca.StarComponents[i]]);
                    }
                }
                IsStar = false;
            }