Example #1
0
void RoboCat::TakeDamage( int inDmgAmount )
{
	mHealth -= inDmgAmount;
	if ( mHealth == 0 )
	{
		SetDoesWantToDie( true );
	}
}
bool TommyCoinServer::HandleCollisionWithShip(Ship* inShip)
{
	//kill yourself!
	SetDoesWantToDie(true);

	ScoreBoardManager::sInstance->IncScore(inShip->GetPlayerID(), 1);

	return false;
}
Example #3
0
void Yarn::Update( float inDeltaTime )
{
	SetLocation( GetLocation() + mVelocity * inDeltaTime );
	
	mLifeSpan += inDeltaTime;
	if ( mLifeSpan > kMaxLifeSpan )
	{
		//on death, do damage to the target cat
		SetDoesWantToDie( true );
		if ( mTargetCat && !mTargetCat->DoesWantToDie() )
		{
			mTargetCat->GetAsCat()->TakeDamage( mShooterCat, 1 );
		}
	}
}
void RoboCatServer::TakeDamage( int inDamagingPlayerId )
{
	mHealth--;
	if( mHealth <= 0.f )
	{
		//score one for damaging player...
		ScoreBoardManager::sInstance->IncScore( inDamagingPlayerId, 1 );

		//and you want to die
		SetDoesWantToDie( true );

		//tell the client proxy to make you a new cat
		ClientProxyPtr clientProxy = NetworkManagerServer::sInstance->GetClientProxy( GetPlayerId() );
		if( clientProxy )
		{
			clientProxy->HandleCatDied();
		}
	}

	//tell the world our health dropped
	NetworkManagerServer::sInstance->SetStateDirty( GetNetworkId(), ECRS_Health );
}