当前位置: 首页>>代码示例>>C#>>正文


C# Entity.Initialize方法代码示例

本文整理汇总了C#中System.Entity.Initialize方法的典型用法代码示例。如果您正苦于以下问题:C# Entity.Initialize方法的具体用法?C# Entity.Initialize怎么用?C# Entity.Initialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Entity的用法示例。


在下文中一共展示了Entity.Initialize方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Add

 /// <summary>
 /// Adds a entity to the scene.
 /// </summary>
 /// <param name="entity">The entity.</param>
 public void Add(Entity entity)
 {
     if (entity == null) return;
     entity.Scene = scene;
     entities.Add(entity.Id, entity);
     entity.Initialize();
     EntityAdded?.Invoke(this, new EntityEventArgs(entity));
 }
开发者ID:ChristianGreiner,项目名称:Avocado2D-old,代码行数:12,代码来源:EntityManager.cs

示例2: AddEntity

        /// <summary>
        /// Adds an entity to the manager
        /// </summary>
        /// <param name="aEntity"></param>
        public static void AddEntity(Entity aEntity)
        {
            //add entity to the master list
            if (!_masterList.Contains(aEntity))
            {
                //TODO: Double check this, essentially in order to perform this operation I have to temporarily cast
                //the master list to a list of game objects
                //GameObject.AddToList(_masterList, aEntity);
                _masterList.Add(aEntity);
            }

            if (_isInitialized)
            {
                aEntity.Initialize();
            }
        }
开发者ID:Wikzo,项目名称:Hagenberg_2015,代码行数:20,代码来源:EntityManager.cs

示例3: ComponentTest

        public static void ComponentTest()
        {
            XEngineComponentTest testGame = new XEngineComponentTest();

            ScenegraphManager scenegraph = new ScenegraphManager( testGame ); ;
            Entity entity1 = null;
            Entity entity2 = null;
            Entity entity3 = null;
            testGame.InitDelegate = delegate {
                scenegraph.Initialize();

                entity1 = new Entity();
                PrimitiveRenderComponent.AddTestComponent( entity1, GeometricPrimitiveType.Sphere, 1.0f);
                MoveComponent.AddTestComponent( entity1 );
                entity1.Initialize();
                scenegraph.AddEntity( entity1, null );

                entity2 = new Entity();
                PrimitiveRenderComponent.AddTestComponent( entity2, GeometricPrimitiveType.Cube, 1.0f );
                entity2.Initialize();
                Transform transform2 = entity2.GetAttribute<Transform>( Attributes.TRANSFORM );
                transform2.Position = new Vector3( 0, 1.0f, 0 );
                transform2.Rotation = Matrix.CreateRotationY( MathHelper.PiOver4 );
                transform2.Scale = new Vector3( 0.5f );
                scenegraph.AddEntity( entity2, entity1 );

                entity3 = new Entity();
                PrimitiveRenderComponent.AddTestComponent( entity3, GeometricPrimitiveType.Cube, 1.0f );
                entity3.Initialize();
                Transform transform3 = entity3.GetAttribute<Transform>( Attributes.TRANSFORM );
                transform3.Position = new Vector3( 1.5f, 0, 0 );
                scenegraph.AddEntity( entity3, entity2 );

            };
            testGame.UpdateDelegate = delegate( GameTime gameTime ) {
                entity1.Update( gameTime );
                entity2.Update( gameTime );
                entity3.Update( gameTime );
                scenegraph.Update( gameTime );
            };
            testGame.DrawDelegate = delegate( GameTime gameTime ) {
                entity1.Draw( gameTime );
                entity2.Draw( gameTime );
                entity3.Draw( gameTime );
            };
            testGame.Run();
        }
开发者ID:tgorkin,项目名称:XEngine,代码行数:47,代码来源:ScenegraphManager.cs

示例4: ComponentTest

        public static void ComponentTest()
        {
            XEngineComponentTest testGame = new XEngineComponentTest();

            Entity entity = null;
            testGame.InitDelegate = delegate {
                entity = new Entity();
                ModelRenderComponent.AddShipTestComponent( entity );
                AddTestComponent( entity );
                entity.Initialize();
            };
            testGame.UpdateDelegate = delegate( GameTime gameTime ) {
                entity.Update( gameTime );
            };
            testGame.DrawDelegate = delegate( GameTime gameTime ) {
                entity.Draw( gameTime );
            };
            testGame.Run();
        }
开发者ID:tgorkin,项目名称:XEngine,代码行数:19,代码来源:MoveComponent.cs

示例5: ComponentTest

        public static void ComponentTest()
        {
            XEngineComponentTest testGame = new XEngineComponentTest();

            Entity entity1 = null;
            Entity entity2 = null;
            testGame.InitDelegate = delegate {
                entity1 = new Entity();
                AddTestComponent( entity1, GeometricPrimitiveType.Sphere, 2.0f );
                entity1.Initialize();

                entity2 = new Entity();
                AddTestComponent( entity2, GeometricPrimitiveType.Cube, 1.0f );
                Transform transform = entity2.GetAttribute<Transform>( Attributes.TRANSFORM );
                transform.Position = new Vector3( 5.0f, 0, 0 );
                transform.UpdateWorld(null);
                entity2.Initialize();
            };
            testGame.DrawDelegate = delegate( GameTime gameTime ) {
                entity1.Draw( gameTime );
                entity2.Draw( gameTime );
            };
            testGame.Run();
        }
开发者ID:tgorkin,项目名称:XEngine,代码行数:24,代码来源:PrimitiveRenderComponent.cs

示例6: Initialize

 public override void Initialize()
 {
     fond_transition = new Entity();
     fond_transition.Initialize(new Pos(fond_transition.Pos.X ,fond_transition.Pos.Y));
     fond_transition.LoadContent("transition", "spirale");
 }
开发者ID:Lyloox,项目名称:Abimn,代码行数:6,代码来源:Transition.cs

示例7: Initialize

        public override void Initialize()
        {
            fond_interact = new Entity();
            fond_interact.Initialize(new Pos(fond_interact.Pos.X, fond_interact.Pos.Y + 470));
            fond_interact.LoadContent("interact", "bis");
            fond_interact.Opacity = 0.8f;

            talk = "";
            _idtext = 1;
            color_font = Color.White;
            vect.X = 30;
            vect.Y = 500;
            choice = 1;
            random = 0;
            ask = false;
        }
开发者ID:Lyloox,项目名称:Abimn,代码行数:16,代码来源:Interact.cs

示例8: ComponentTest

        public static void ComponentTest()
        {
            XEngineComponentTest testGame = new XEngineComponentTest();

            Entity entity1 = null;
            Entity entity2 = null;
            testGame.InitDelegate = delegate {
                entity1 = new Entity();
                AddShipTestComponent( entity1 );
                entity1.AddAttribute( Attributes.TRANSFORM, new Transform( new Vector3( 0, 1.0f, 0 ) ) );
                entity1.Initialize();

                entity2 = new Entity();
                AddGridTestComponent( entity2 );
                entity2.Initialize();
            };
            testGame.DrawDelegate = delegate( GameTime gameTime ) {
                entity1.Draw( gameTime );
                entity2.Draw( gameTime );
            };
            testGame.Run();
        }
开发者ID:tgorkin,项目名称:XEngine,代码行数:22,代码来源:ModelRenderComponent.cs

示例9: Add

 public void Add(Entity e)
 {
     if (m_enumeratingActiveSet) {
         m_addedEntities.Add (e);
     } else {
         e.LoadContent (Content);
         m_entities.Add (e);
         e.Initialize ();
     }
 }
开发者ID:jorgenpt,项目名称:1GAM-02-Railsrogue,代码行数:10,代码来源:RailsrogueGame.cs


注:本文中的System.Entity.Initialize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。