本文整理汇总了C#中System.Objects.doDamage方法的典型用法代码示例。如果您正苦于以下问题:C# Objects.doDamage方法的具体用法?C# Objects.doDamage怎么用?C# Objects.doDamage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Objects
的用法示例。
在下文中一共展示了Objects.doDamage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: checkTwoObjects
private void checkTwoObjects(Objects.StaticObject obj1, Objects.StaticObject obj2)
{
if (obj1 is Objects.Projectile || obj2 is Objects.Projectile)
{
if (obj1 is Objects.Projectile)
{
if (obj2.Equals(((Objects.Projectile)obj1).parent))
return;
obj1.doDamage(10000);
obj2.doDamage(((Objects.Projectile)obj1).damage);
if (obj2 is Objects.playerObject)
{
if (numPlayers.Equals(Players.two))
{
explosion.Play();
}
else
{
if (obj2.Team.Equals(Team.Red))
explosion.Play();
}
}
}
else
{
if (obj1.Equals(((Objects.Projectile)obj2).parent))
return;
obj2.doDamage(10000);
obj1.doDamage(((Objects.Projectile)obj2).damage);
if (obj1 is Objects.playerObject)
{
if (numPlayers.Equals(Players.two))
{
explosion.Play();
}
else
{
if (obj1.Team.Equals(Team.Red))
explosion.Play();
}
}
}
}
else
{
// add object collision settings
if (obj1 is Objects.DynamicObject && obj2 is Objects.DynamicObject)
{
Objects.DynamicObject d1 = obj1 as Objects.DynamicObject;
Objects.DynamicObject d2 = obj2 as Objects.DynamicObject;
d1.bumpVelocity += Vector3.Normalize(Matrix.CreateFromQuaternion(d2.rotation).Forward) * d2.Mass * d2.ShipMovementInfo.speed / d1.Mass * COLLISION_SPEED_PRESERVATION;
d2.bumpVelocity += Vector3.Normalize(Matrix.CreateFromQuaternion(d1.rotation).Forward) * d1.Mass * d1.ShipMovementInfo.speed / d2.Mass * COLLISION_SPEED_PRESERVATION;
}
else if (obj1 is Objects.DynamicObject)
{
Objects.DynamicObject d = obj1 as Objects.DynamicObject;
d.bumpVelocity += Vector3.Normalize(Matrix.CreateFromQuaternion(d.rotation).Backward) * d.ShipMovementInfo.speed * COLLISION_SPEED_PRESERVATION;
}
else if (obj2 is Objects.DynamicObject)
{
Objects.DynamicObject d = obj2 as Objects.DynamicObject;
d.bumpVelocity += Vector3.Normalize(Matrix.CreateFromQuaternion(d.rotation).Backward) * d.ShipMovementInfo.speed * COLLISION_SPEED_PRESERVATION;
}
obj1.ShipMovementInfo.speed = 0;
obj2.ShipMovementInfo.speed = 0;
}
}