void Yarn::InitFromShooter( GameObjectPtr inShooter, GameObjectPtr inTarget ) { SetPlayerId( inShooter->GetPlayerId() ); Vector3 forward = inTarget->GetLocation() - inShooter->GetLocation(); SetVelocity( forward * kMuzzleSpeed ); SetLocation( inShooter->GetLocation() ); mShooterCat = inShooter; mTargetCat = inTarget; }
void RoboCat::EnterAttackState( uint32_t inTargetNetId ) { mTargetNetId = inTargetNetId; //cache the target cat GameObjectPtr go = NetworkManager::sInstance->GetGameObject( mTargetNetId ); //double check this attack target is valid if ( go && go->GetClassId() == RoboCat::kClassId && go->GetPlayerId() != GetPlayerId() ) { mTargetCat = go; mState = RC_ATTACK; } else { mState = RC_IDLE; } }