本文整理汇总了C#中GameEngine.RemoveEntity方法的典型用法代码示例。如果您正苦于以下问题:C# GameEngine.RemoveEntity方法的具体用法?C# GameEngine.RemoveEntity怎么用?C# GameEngine.RemoveEntity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameEngine
的用法示例。
在下文中一共展示了GameEngine.RemoveEntity方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Update
public override void Update(GameTime gameTime, GameEngine.TeeEngine engine)
{
this.Opacity -= 0.02f;
this.Drawables.SetStateProperty("standard", "Offset", this._offset);
this._offset.Y -= 1;
if (this.Opacity < 0)
engine.RemoveEntity(this);
base.Update(gameTime, engine);
}
示例2: Update
public override void Update(GameTime gameTime, GameEngine.TeeEngine engine)
{
this.Drawables.SetStateProperty("standard", "Offset", this._offset);
if (_direction == Direction.Up)
{
this._offset.Y -= (_targetY - Math.Abs(_offset.Y)) * 0.05f;
if (Math.Abs(this._offset.Y) >= _targetY - 3)
engine.RemoveEntity(this);
}
else if (_direction == Direction.Down)
{
this._offset.Y += (_targetY - Math.Abs(_offset.Y)) * 0.05f;
if (Math.Abs(this._offset.Y) >= _targetY - 3)
engine.RemoveEntity(this);
}
base.Update(gameTime, engine);
}
示例3: Update
public override void Update(GameTime gameTime, GameEngine.TeeEngine engine)
{
if (Entity.IntersectsWith(this, "Body", Target, "Body", gameTime))
{
// Target is hit
if (Target is NPC)
{
NPC target = (NPC)Target;
target.OnHit(this, Damage, gameTime, engine);
}
engine.RemoveEntity(this);
}
else
{
double distance = Vector2.Distance(Pos, MoveTo);
if (distance < 10)
{
// TODO check for attack succeeding
engine.RemoveEntity(this);
}
else
{
Pos.X += (float)(Math.Cos(_moveAngle) * Speed);
Pos.Y += (float)(Math.Sin(_moveAngle) * Speed);
}
}
}
示例4: Update
public override void Update(GameTime gameTime, GameEngine.TeeEngine engine)
{
// Get the Hero player for interaction purposes.
Hero player = (Hero)engine.GetEntity("Player");
Vector2 prevPos = Pos;
AttackTarget = player;
// Check if this Bat has died.
if (HP <= 0)
{
this.Opacity -= 0.02f;
this.Drawables.ResetState(CurrentDrawableState, gameTime);
if (this.Opacity < 0)
{
if (!_goldGiven) SpawnCoins(engine);
engine.RemoveEntity(this);
}
}
else
{
// ATTACKING LOGIC.
if (Stance == AttackStance.Attacking)
{
this.Pos.X -= (float)(Math.Cos(_attackAngle) * _attackSpeed);
this.Pos.Y -= (float)(Math.Sin(_attackAngle) * _attackSpeed);
this._attackHeight.Y += 30.0f / ATTACK_COUNTER_LIMIT;
this.Drawables.SetGroupProperty("Body", "Offset", _attackHeight);
onAttack(engine, gameTime);
}
// ATTACK PREPERATION LOGIC.
else if (Stance == AttackStance.Preparing)
{
_attackHeight.Y -= 2;
if (_attackHeight.Y < -40)
{
_attackHeight.Y = -40;
_attackAngle = Math.Atan2(
this.Pos.Y - player.Pos.Y,
this.Pos.X - player.Pos.X
);
Stance = AttackStance.Attacking;
_attackCounter = 0;
}
Drawables.SetGroupProperty("Body", "Offset", _attackHeight);
}
// NON-ATTACKING LOGIC. PATROL AND APPROACH.
else if (Stance == AttackStance.NotAttacking)
{
double distance = Vector2.Distance(player.Pos, this.Pos);
if (distance < AggroDistance && player.HP > 0)
{
// Move towards the player for an attack move.
double angle = Math.Atan2(
player.Pos.Y - this.Pos.Y,
player.Pos.X - this.Pos.X
);
// Approach Function.
double moveValue;
if (distance < AttackDistance)
{
Stance = AttackStance.Preparing;
moveValue = 0;
}
else
moveValue = _moveSpeed;
Pos.X += (float)(Math.Cos(angle) * moveValue);
Pos.Y += (float)(Math.Sin(angle) * moveValue);
}
else
{
// Perform a standard patrol action.
Pos.X += (float)(Math.Cos(gameTime.TotalGameTime.TotalSeconds - _randomModifier * 90) * 2);
}
}
else if (Stance == AttackStance.Retreating)
{
double distance = Vector2.Distance(player.Pos, this.Pos);
if (distance < AggroDistance * 1.10)
{
if (_attackHeight.Y < -10)
{
_attackHeight.Y += 0.4f;
if (_attackHeight.Y > -10)
_attackHeight.Y = -10;
Drawables.SetGroupProperty("Body", "Offset", _attackHeight);
}
double angle = Math.Atan2(
player.Pos.Y - this.Pos.Y,
player.Pos.X - this.Pos.X
);
//.........这里部分代码省略.........