예제 #1
0
        /// <summary>
        /// Called by the EntityFramework. Do not call directly.
        /// </summary>
        public void Initialize()
        {
            _physics    = new EntityPhysics(this);
            _components = new List <KeyValuePair <EntityComponent, IEntityComponentHandler> >();

            EventListener = new EntityEventListener(this);

            SystemHandler.EditorGameStart += OnStart;
            SystemHandler.EditorGameEnded += OnEnd;

            OnInitialize();

            // Continue straight to OnStart if running in Standalone.
            if (!Env.IsSandbox)
            {
                OnStart();
            }
        }
예제 #2
0
        internal void InitializeManagedEntity(Type type)
        {
            _components = new List <EntityComponent>();

            EventListener = new EntityEventListener(this);

            SystemEventHandler.EditorGameStart += OnStart;
            SystemEventHandler.EditorGameEnded += OnEnd;

            // Call the default constructor
            var constructor = type.GetConstructor(Type.EmptyTypes);

            constructor.Invoke(this, null);

            // Continue straight to OnStart if running in Standalone.
            if (!Engine.IsSandbox)
            {
                OnStart();
            }
        }