internal void RegisterComponent_Internal(ActorComponent Component)
        {
            if (Component == null)
            {
                throw new ArgumentNullException(nameof(Component));
            }
            if (HasComponent(Component.Name))
            {
                throw new DuplicateComponentException("Duplicate Name: " + Component.Name);
            }

            if (Component.Name == null)
            {
                string BaseName = Component.GetType().Name;
                if (Component.Script == null)
                {
                    BaseName = "NATIVE_" + BaseName;
                }

                int CompCount = AllComponents.Count(x => x.Name.Remove(x.Name.LastIndexOf("_")) == BaseName);
                Component.Name = string.Format("{0}_{1}", BaseName, CompCount);
            }

            _AllComponents.Add(Component);
        }
Esempio n. 2
0
        internal void UnregisterComponent_Internal(ActorComponent Component)
        {
            if (Component == null)
            {
                throw new ArgumentNullException(nameof(Component));
            }

            Component.Internal_Destroy();

            _AllComponents.Remove(Component);
        }