bool CharacterUpdaterPlayer::reportAttack(CCObject *attackedBy, const float force, const float damage, const float x, const float y, const float z)
{
    if( health > 0.0f )
    {
        health -= damage;
    }

    CCVector3 attackVelocity = CCVector3( x, y, z );
    attackVelocity.unitize();
    attackVelocity.mul( force * 0.1f );
    player->incrementAdditionalVelocity( attackVelocity.x, attackVelocity.y, attackVelocity.z );
    findNewAnchor = true;

    player->getGame()->registerAttack( attackedBy, player, damage );

    return false;
}
Esempio n. 2
0
static bool lineCheckGetIntersection(const float dist1, const float dist2, const CCVector3 &point1, const CCVector3 &point2, CCVector3 &hitLocation) 
{
	if( ( dist1 * dist2 ) >= 0.0f )
	{
		return false;
	}
	
	if( dist1 == dist2 )
	{ 
		return false;
	}
	
    // point1 + ( point2 - point1 ) * ( -dst1 / ( dst2 - dst1 ) );
    hitLocation = point2;
    hitLocation.sub( point1 );
    hitLocation.mul( -dist1 / ( dist2 - dist1 ) );
    hitLocation.add( point1 );
	
	return true;
}