Good morning AFCS fans,
I working on a simple mutiplayer game based on AFCS. In this
game, players play after each other so I have to manage turns.
I've tried using the SharedModel of the game to dael with
that. The first player connected to the room gets the owner role
and is responsible to manage the turns. I'm using the AFCS roles to
give and take the right to play: the current player has Publisher's
role and all others have Viewer role on the node.
So, in my application, when someone looses, he looses his
Publisher role and the Owner assigns it to the next player. That's
where I fail...
I'm using the following code to find the next player:
quote:
_collectionNode.setUserRole(p_evt.userID, UserRoles.VIEWER,
NODENAME_SELECT);
var
currentPlayerDesc:UserDescriptor=_userManager.getUserDescriptor(p_evt.userID);
var
currentPlayerIndex:int=_userManager.participantCollection.getItemIndex(currentPlayerDesc);
if
(currentPlayerIndex==_userManager.participantCollection.length-1)
currentPlayerIndex=-1;
var
newPlayer:String=_userManager.userCollection.getItemAt(currentPlayerIndex+1)
as String
_collectionNode.setUserRole(newPlayer, UserRoles.PUBLISHER,
NODENAME_SELECT);
My first problem is that the current player descriptor is
null... So, it can't work.
So, my questions are:
- Should I use the Baton class instead of doing it in my
SharedModel?
- What do I do wrong to get a void descriptor?
Is there an exemple somewhere of a similar token-based access
right?
Thanks a lot in advance,
Axel