本文整理汇总了C#中Ship.Damage方法的典型用法代码示例。如果您正苦于以下问题:C# Ship.Damage方法的具体用法?C# Ship.Damage怎么用?C# Ship.Damage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ship
的用法示例。
在下文中一共展示了Ship.Damage方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckBulletsHitTarget
public override GameObject CheckBulletsHitTarget(Ship ship)
{
foreach (Missile bullet in ActiveBullets)
{
if (ship.Bounds.Intersects(bullet.Bounds))
{
AnimatedGameObject explosion = Explosion.Clone();
explosion.SetPosition(bullet.Position);
ExplosionsToAdd.Add(explosion);
bullet.Die();
ship.Damage(TurretData.BulletDamage);
return ship;
}
}
return null;
}
示例2: Main
static void Main()
{
Ship theShip = new Ship( int.Parse(Console.ReadLine()), // reads the ship's coordinates: Sx1,
int.Parse(Console.ReadLine()), // Sy1,
int.Parse(Console.ReadLine()), // Sx2,
int.Parse(Console.ReadLine()) // Sy2 (and sort them!)
);
int Hy = int.Parse(Console.ReadLine()); // reads the horizon line
int Damage = 0;
for (int i = 0; i < 3; i++)
{
int Cx = int.Parse(Console.ReadLine()); // reads the x coordinate of i-th cathapult
int Cy = int.Parse(Console.ReadLine()); // reads the y coordinate of i-th cathapult
Damage += theShip.Damage(Cx, Hy + (Hy - Cy)); // transfers the Cy coordinate at the opposite side of horizon
}
Console.WriteLine("{0}%", Damage);
}
示例3: CheckBulletsHitTarget
public override GameObject CheckBulletsHitTarget(Ship ship)
{
if (Beam != null)
{
if (_2DGeometry.LineIntersectsRect(Position, Beam.Destination, ship.Bounds))
{
Beam.SetBulletTargetDestination(ship.Position);
if (beamDamageTimer > 0.2f)
{
ship.Damage(TurretData.BulletDamage);
beamDamageTimer = 0;
}
else
{
beamDamageTimer += 0.01f;
}
return ship;
}
}
return null;
}
示例4: CheckBulletsHitTarget
public virtual GameObject CheckBulletsHitTarget(Ship ship)
{
foreach (Bullet bullet in ActiveBullets)
{
if (ship.Bounds.Intersects(bullet.Bounds))
{
bullet.Die();
ship.Damage(TurretData.BulletDamage);
return ship;
}
}
return null;
}