本文整理汇总了C#中GameEngine.AddEntity方法的典型用法代码示例。如果您正苦于以下问题:C# GameEngine.AddEntity方法的具体用法?C# GameEngine.AddEntity怎么用?C# GameEngine.AddEntity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameEngine
的用法示例。
在下文中一共展示了GameEngine.AddEntity方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: onAttack
public override void onAttack(GameEngine.TeeEngine engine, GameTime gameTime)
{
BeeProjectile attack = new BeeProjectile(Pos.X, Pos.Y, AttackTarget);
attack.Damage = Damage;
engine.AddEntity(attack);
Stance = AttackStance.Retreating;
}
示例2: SpawnMob
public void SpawnMob(GameEngine.TeeEngine engine)
{
string type = _splitMobs[randomGenerator.Next(0, _splitMobs.Count)];
Vector2 pos = new Vector2(Pos.X + (CurrentBoundingBox.Width * (float)randomGenerator.NextDouble()), Pos.Y + (CurrentBoundingBox.Height * (float)randomGenerator.NextDouble()));
Mob mob;
switch (type)
{
case "Bat":
mob = new Bat(pos.X, pos.Y);
break;
case "Bee":
mob = new Bee(pos.X, pos.Y);
break;
default:
mob = new Bee(pos.X, pos.Y);
break;
}
engine.AddEntity(mob);
}
示例3: SpawnCoins
/// <summary>
/// Spawns coins around the mob
/// </summary>
/// <param name="engine">The current engine, needed to add new coins entities to the game.</param>
public void SpawnCoins(GameEngine.TeeEngine engine)
{
// Spawn gold
float range = CurrentBoundingBox.Width * 2;
int num = randomGenerator.Next(0, 6);
float minX = Pos.X - range;
float maxX = Pos.X + range;
float minY = Pos.Y - range;
float maxY = Pos.Y + range;
for (int i = 0; i < num; i++)
{
int type = randomGenerator.Next(1, 10);
float x = ((float)randomGenerator.NextDouble() * (maxX - minX) + minX);
float y = ((float)randomGenerator.NextDouble() * (maxY - minY) + minY);
Coin c;
switch(type)
{
case 6:
case 7:
case 8:
c = new Coin(Pos.X, Pos.Y, WorthGold * 2, CoinType.Silver, x, y);
break;
case 9:
c = new Coin(Pos.X, Pos.Y, WorthGold * 3, CoinType.Gold, x, y);
break;
default:
c = new Coin(Pos.X, Pos.Y, WorthGold, CoinType.Copper, x, y);
break;
}
engine.AddEntity(c);
}
_goldGiven = true;
}