本文整理汇总了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));
}
示例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();
}
}
示例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();
}
示例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();
}
示例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();
}
示例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");
}
示例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;
}
示例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();
}
示例9: Add
public void Add(Entity e)
{
if (m_enumeratingActiveSet) {
m_addedEntities.Add (e);
} else {
e.LoadContent (Content);
m_entities.Add (e);
e.Initialize ();
}
}