Beispiel #1
0
        private T AddComponent <T>() where T : GameFrameworkComponent
        {
            Type                   type         = typeof(T);
            GameObject             newComponent = new GameObject(typeof(T).Name);
            GameFrameworkComponent component    = newComponent.AddComponent <T>();

            if (component == null)
            {
                Debuger.LogError(Utility.StringUtility.Format("can not add the component '{0}' .", type.FullName));
                return(null);
            }
            newComponent.transform.parent   = ComponentRoot;
            newComponent.transform.position = Vector3.zero;
            RegisterComponent(component);
            return((T)component);
        }
Beispiel #2
0
        public bool IsHaveComponent(GameFrameworkComponent gameFrameworkComponent)
        {
            Type type = gameFrameworkComponent.GetType();

            LinkedListNode <GameFrameworkComponent> current = GameFrameworkComponents.First;

            while (current != null)
            {
                if (current.Value.GetType() == type)
                {
                    Debuger.LogError("Game Framework component type '{0}' is already exist.", LogColor.Red,
                                     type.FullName);
                    return(true);
                }

                current = current.Next;
            }
            return(false);
        }