예제 #1
0
    /// <summary>
    /// 碰撞检测
    /// </summary>
    /// <param name="collParas"></param>
    /// <returns></returns>
    private bool DetectCollisionWithEnemyBullet(EnemyBulletBase bullet)
    {
        int  nextColliderIndex = 0;
        int  curColliderIndex;
        bool isCollided = false;

        do
        {
            CollisionDetectParas collParas = bullet.GetCollisionDetectParas(nextColliderIndex);
            curColliderIndex  = nextColliderIndex;
            nextColliderIndex = collParas.nextIndex;
            if (DetectCollisionWithCollisionParas(collParas))
            {
                bullet.CollidedByObject(curColliderIndex, _eliminateType);
                isCollided = true;
            }
        } while (nextColliderIndex != -1);
        return(isCollided);
    }
 /// <summary>
 /// 与敌机子弹发生碰撞
 /// </summary>
 /// <param name="bullet"></param>
 /// <param name="curColliderIndex"></param>
 protected virtual void CollidedByEnemyBullet(EnemyBulletBase bullet, int curColliderIndex)
 {
     bullet.CollidedByObject(curColliderIndex, _eliminateType);
 }