本文整理汇总了C#中ICollidable.Collided方法的典型用法代码示例。如果您正苦于以下问题:C# ICollidable.Collided方法的具体用法?C# ICollidable.Collided怎么用?C# ICollidable.Collided使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICollidable
的用法示例。
在下文中一共展示了ICollidable.Collided方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckCollision
private void CheckCollision(ICollidable i_Source)
{
foreach (ICollidable target in m_Collidables)
{
if (i_Source != target && target.Visible)
{
if (Check2DCollision(i_Source, target))
{
target.Collided(i_Source);
i_Source.Collided(target);
}
}
}
}
示例2: checkCollision
private void checkCollision(ICollidable i_Source)
{
List<ICollidable> collidedComponents = new List<ICollidable>();
// finding who collided with i_Source:
foreach (ICollidable target in r_Collidables)
{
if (i_Source.Visible && i_Source != target && target.Visible)
{
if (target.CheckCollision(i_Source))
{
collidedComponents.Add(target);
}
}
}
// Informing i_Source and all the collided targets about the collision:
foreach (ICollidable target in collidedComponents)
{
target.Collided(i_Source);
i_Source.Collided(target);
}
}
示例3: CollisionTest
public bool CollisionTest(ICollidable enemyBase)
{
foreach (IEnemy e in EnemiesActive)
{
ICollidable enemyActor = (ICollidable)e;
if ((enemyActor != enemyBase) && (enemyBase.Collided(enemyActor))) return true;
}
return false;
}
示例4: checkCollision
/// <summary>
/// Checking if a collision occured for specified component
/// </summary>
/// <param name="i_Source">specified component</param>
private void checkCollision(ICollidable i_Source)
{
// Checking for collision with each of the observed components
foreach (ICollidable target in m_Collidables)
{
// Validating both collidables are visible, differ and
// not in a dying state
if (i_Source.Visible &&
i_Source != target &&
target.Visible &&
!i_Source.Dying &&
!target.Dying)
{
// Checking if collision occured
if (target.CheckForCollision(i_Source))
{
target.Collided(i_Source);
i_Source.Collided(target);
}
}
}
}