本文整理汇总了C#中BEPUphysics.Entities.Entity.BecomeDynamic方法的典型用法代码示例。如果您正苦于以下问题:C# Entity.BecomeDynamic方法的具体用法?C# Entity.BecomeDynamic怎么用?C# Entity.BecomeDynamic使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BEPUphysics.Entities.Entity
的用法示例。
在下文中一共展示了Entity.BecomeDynamic方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BepuBody
public BepuBody(Entity realBody)
{
RealBody = realBody;
RealBody.Tag = -1;
RealBody.BecomeDynamic((float)_mass);
//RealBody.CollisionInformation.LocalPosition = new Vector3(0, 0, -10); //center of mass?
BepuEntityCollidableToBepuBody.Add(realBody.CollisionInformation, this);
//TODO. fix after new bodies.
/* RealBody.CollisionInformation.Events.InitialCollisionDetected +=
(thisBody, other, x)=>
{
if (other is EntityCollidable)
Body.RaiseCollisionEvent(BepuEntityCollidableToBepuBody[other as EntityCollidable].Body);
};*/
//IsStatic = false;
}
示例2: tankCollision
public void tankCollision(Entity sender, Entity other, CollisionPair pair)
{
var enemy = other.Tag as TriangleMesh;
if (enemy != null)
{
// Terrain was hit!
}
var enemy2 = other.Tag as Player; // Player tank was was hit!
if (enemy2 != null)
{
if (!enemy2.EnemyCollision)
enemy2.tank.Velocity = -enemy2.tank.Velocity;
enemy2.EnemyCollision = true;
}
var enemy3 = other.Tag as Enemy;
if (enemy3 != null)
{ } // Enemy was hit
var enemy4 = other.Tag as Wall;
if (enemy4 != null && (other.IsDynamic == false))
other.BecomeDynamic(1f);
}
示例3: EntityEntersVolume
/// <summary>
/// Handles what happens when an entity enters the wall's hit volume.
/// If it's an enemy, boom!!
/// </summary>
/// <param name="toucher">Entity touching the volume.</param>
/// <param name="volume">Volume being touched.</param>
public void EntityEntersVolume(Entity sender, Entity other, CollisionPair pair)
{
var enemy = other.Tag as TriangleMesh;
if (enemy != null)
{
// Terrain was hit!
}
var enemy2 = other.Tag as Player;
if (enemy2 != null)
{
if (enemy2.Life < 100) // Player tank caught heath package!
{
space.Remove(body);
game.Components.Remove(this);
Random rand = new Random(0);
;
enemy2.Life = Math.Min(100, enemy2.Life + (int)((float)rand.NextDouble() * 30f + 20f) );
}
}
var enemy3 = other.Tag as Enemy;
if (enemy3 != null) // Enemy caught heath package!
{
if (enemy3.Life < 150)
{
space.Remove(body);
game.Components.Remove(this);
Random rand = new Random(0);
enemy3.Life = Math.Min(150, enemy3.Life + Math.Min(150, enemy3.Life + (int)((float)rand.NextDouble() * 30f + 30f)));
}
}
var enemy4 = other.Tag as Wall;
if (enemy4 != null && (other.IsDynamic == false))
other.BecomeDynamic(1f);
var enemy5 = other.Tag as Building;
if (enemy5 != null)
{
} // Church was hit, not nice
}
示例4: tankCollision
public void tankCollision(Entity sender, Entity other, CollisionPair pair)
{
var enemy = other.Tag as TriangleMesh;
if (enemy != null)
{
// Terrain was hit!
}
var enemy2 = other.Tag as Player;
if (enemy2 != null)
{
// Player tank was was hit!
}
var enemy3 = other.Tag as Enemy;
if (enemy3 != null)
{
if (!player.EnemyCollision)
player.tank.Velocity = -player.tank.Velocity;
player.EnemyCollision = true;
} // Enemy was hit
var enemy4 = other.Tag as Wall;
if (enemy4 != null && (other.IsDynamic == false))
other.BecomeDynamic(1f);
var enemy5 = other.Tag as Building;
if (enemy5 != null)
{
if (!player.EnemyCollision)
player.tank.Velocity = -player.tank.Velocity;
player.EnemyCollision = true;
}
var enemy6 = other.Tag as HardWall;
if (enemy6 != null)
{
if (!player.EnemyCollision)
player.tank.Velocity = -player.tank.Velocity;
player.EnemyCollision = true;
}
}