本文整理汇总了C#中Enemy.Initialize方法的典型用法代码示例。如果您正苦于以下问题:C# Enemy.Initialize方法的具体用法?C# Enemy.Initialize怎么用?C# Enemy.Initialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Enemy
的用法示例。
在下文中一共展示了Enemy.Initialize方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitializeParts
public void InitializeParts()
{
mainEmitter = new BulletEmitter(this, Origin, false);
mainEmitter.LockedToParentPosition = true;
mainEmitter.LockPositionOffset = Vector2.Zero;
ring1 = new Enemy(thisScene, Origin);
ring1.Initialize();
ring1.DeletionBoundary = DeletionBoundary;
ring1.DrawAtTrueRotation = true;
ring1.Color = Color.White;
ring1.Origin = Origin;
ring1.SetParent(this);
ring1.SetTexture(boss5Ring1Texture);
ring1.LockedToParentPosition = true;
ring1.Center = this.Center;
ring1.DrawLayer = .32f;
ring2 = new Enemy(thisScene, Origin);
ring2.Initialize();
ring2.DeletionBoundary = DeletionBoundary;
ring2.DrawAtTrueRotation = true;
ring2.Color = Color.White;
ring2.Origin = Origin;
ring2.SetParent(this);
ring2.SetTexture(boss5Ring2Texture);
ring2.LockedToParentPosition = true;
ring2.Center = this.Center;
ring2.DrawLayer = .31f;
ring1Emitters = new List<BulletEmitter>()
{
new BulletEmitter(ring1, new Vector2(130, 175)),
new BulletEmitter(ring1, new Vector2(130, 294)),
new BulletEmitter(ring1, new Vector2(381, 175)),
new BulletEmitter(ring1, new Vector2(381, 294))
};
ring2Emitters = new List<BulletEmitter>()
{
new BulletEmitter(ring2, new Vector2(195, 110)),
new BulletEmitter(ring2, new Vector2(117, 234.5f)),
new BulletEmitter(ring2, new Vector2(195, 359)),
new BulletEmitter(ring2, new Vector2(316, 110)),
new BulletEmitter(ring2, new Vector2(394, 234.5f)),
new BulletEmitter(ring2, new Vector2(316, 359))
};
// Setup the ring emitter properties.
foreach (BulletEmitter be in ring1Emitters)
{
be.Center = Center + (be.Center - Origin);
be.DeletionBoundary = new Vector2(99999, 99999);
be.CustomValue1 = Vector2.Distance(Center, be.Center);
be.Rotation = VectorMathHelper.GetAngleTo(Center, be.Center);
}
// Setup the ring emitter properties.
foreach (BulletEmitter be in ring2Emitters)
{
be.Center = Center + (be.Center - Origin);
be.DeletionBoundary = new Vector2(99999, 99999);
be.CustomValue1 = Vector2.Distance(Center, be.Center);
be.Rotation = VectorMathHelper.GetAngleTo(Center, be.Center);
}
topLayer = new Enemy(thisScene, Origin);
topLayer.Initialize();
topLayer.DeletionBoundary = DeletionBoundary;
topLayer.Color = Color.White;
topLayer.Origin = Origin;
topLayer.SetTexture(boss5TopTexture);
topLayer.SetParent(this);
topLayer.LockedToParentPosition = true;
topLayer.Center = this.Center;
topLayer.DrawLayer = .3f;
rotatingBullets = new List<Bullet>();
}
示例2: AddEnemy
/// <summary>
/// Spawn enemy on the level
/// </summary>
private void AddEnemy()
{
//Create the animation object
Animation enemyAnimation = new Animation();
//Initialize the animation
enemyAnimation.Initialize(
enemyTexture,
Vector2.Zero,
47, 61,
8,
30,
Color.White,
1f,
true);
//Generate random enemy position
Vector2 position = new Vector2(
GraphicsDevice.Viewport.Width + enemyTexture.Width / 2,
random.Next(100, GraphicsDevice.Viewport.Height - 100));
//Create enemy and add to the enemy list
Enemy enemy = new Enemy();
enemy.Initialize(enemyAnimation, position);
enemies.Add(enemy);
}
示例3: AddEnemy
private void AddEnemy()
{
Animation enemyAnimation = new Animation();
enemyAnimation.Initialize(enemyTexture, Vector2.Zero, 47, 61, 8, 30, Color.White, 1f, true);
Vector2 position = new Vector2(GraphicsDevice.Viewport.Width + enemyTexture.Width / 2, random.Next(100, GraphicsDevice.Viewport.Height - 100));
Enemy enemy = new Enemy();
enemy.Initialize(enemyAnimation, position);
enemies.Add(enemy);
}
示例4: Initialize
/// <summary>
/// Allows the game to perform any initialization it needs to before starting to run.
/// This is where it can query for any required services and load any non-graphic
/// related content. Calling base.Initialize will enumerate through any components
/// and initialize them as well.
/// </summary>
protected override void Initialize()
{
// TODO: Add your initialization logic here
base.Initialize();
player = new Player(this);
bullet = new Bullet(this);
weapon = new Weapons(this);
particle = new Particle(this);
Enemy_List = new List<Enemy>();
Particle_list = new List<Particle>();
enemy = new Enemy(this);
player.Initialize();
bullet.Initialize();
enemy.Initialize();
}
示例5: ScatterEnemies
private static List<Enemy> ScatterEnemies(Game game, int numEnemies,
float minDistance, int distance, Player player)
{
List<Enemy> enemyList = new List<Enemy>();
for (int i = 0; i < numEnemies; i++)
{
Enemy enemy = new Enemy(game, UnitTypes.EnemyType.Beast);
enemy.Initialize();
// Generate a random position
Vector3 offset = RandomHelper.GeneratePositionXZ(distance);
while (Math.Abs(offset.X) < minDistance && Math.Abs(offset.Z) < minDistance)
offset = RandomHelper.GeneratePositionXZ(distance);
enemy.Transformation = new Transformation(player.Transformation.Translate +
offset, Vector3.Zero, /*Vector3.One*/ new Vector3((float)0.3, (float)0.3, (float)0.3));
enemy.TransformationOld = enemy.Transformation;
enemy.Player = player;
enemyList.Add(enemy);
}
return enemyList;
}