public bool doTick()
{
ticksReceived++;
// Reach the next action
if (this.ticksReceived >= this.ticksNeeded)
{
int nextMoveTime = 5;
switch (this.currentState)
{
case ((int)statusList.WALKING_BACK):
case ((int)statusList.WALKING):
// stop npc
this.currentState = (int)statusList.STANDING;
this.setXPos(destination.a);
this.setZPos(destination.c);
Random rand = new Random();
nextMoveTime = rand.Next(10, 15);
this.updateAnimation((byte)npc.Animations.STAND);
break;
case ((int)statusList.STANDING_BACK):
case ((int)statusList.STANDING):
// Starts walking
this.currentState = (int)statusList.WALKING;
// ToDo: start walking NPC and recalculate
nextMoveTime = this.generatePathTable();
this.updateAnimation((byte)npc.Animations.WALK);
// Generate walking packet message (raw)
break;
}
this.ticksReceived = 0;
this.ticksNeeded = nextMoveTime;
this.updateClient = true;
}
else
{
this.updateClient = false;
}
return this.updateClient;
}