44 lines
1.2 KiB
C
44 lines
1.2 KiB
C
![]() |
#include "logic.h"
|
||
|
|
||
|
//-----------------------------------------------------------------------------
|
||
|
void Logic::OnBallOwned()
|
||
|
{
|
||
|
Wireless* ourWireless = parent->GetModule<Wireless>(IO_WIRELESS_MAIN);
|
||
|
|
||
|
//ourWireless->Send(WIRELESS_CODE);
|
||
|
//ourWireless->Send();
|
||
|
}
|
||
|
|
||
|
//-----------------------------------------------------------------------------
|
||
|
void Logic::OnBallLost()
|
||
|
{
|
||
|
Wireless* ourWireless = parent->GetModule<Wireless>(IO_WIRELESS_MAIN);
|
||
|
|
||
|
//ourWireless->Send(WIRELESS_CODE);
|
||
|
//ourWireless->Send();
|
||
|
}
|
||
|
|
||
|
//-----------------------------------------------------------------------------
|
||
|
void Logic::Update()
|
||
|
{
|
||
|
// We want to use a navigator
|
||
|
Navigator* ourNavigator = parent->GetModule<Navigator>(IO_NAVIGATOR_MAIN);
|
||
|
|
||
|
// is Keeper?
|
||
|
if(isKeeper) {
|
||
|
// turn around al little bit...
|
||
|
if((status == STATUS_KEEPER_TURN_LEFT && ourNavigator->AngleReached()) ||
|
||
|
(status != STATUS_KEEPER_TURN_LEFT && status != STATUS_KEEPER_TURN_RIGHT)) {
|
||
|
status = STATUS_KEEPER_TURN_RIGHT;
|
||
|
ourNavigator->RotateTo(315,200);
|
||
|
}
|
||
|
else if(status == STATUS_KEEPER_TURN_RIGHT && ourNavigator->AngleReached()) {
|
||
|
status = STATUS_KEEPER_TURN_LEFT;
|
||
|
ourNavigator->RotateTo(45, 200);
|
||
|
}
|
||
|
}
|
||
|
else { // is Player?
|
||
|
|
||
|
}
|
||
|
}
|