summaryrefslogtreecommitdiffstats
path: root/source/Concept/Framework/modules/logic/logic.c
blob: f69849519edc8a9c888fd2c2bc09536ff9263b07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include "logic.h"

//-----------------------------------------------------------------------------
void Logic::OnBallOwned()
{
	this->SetKeeper(false);
}

//-----------------------------------------------------------------------------
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->IsMoving()) ||
			 (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->IsMoving()) {
			status = STATUS_KEEPER_TURN_LEFT;
			ourNavigator->RotateTo(45, 200);
		}
	}
	else { // is Player?
		
	}
}