Couple of small changes to NPC test character.

afrisby
MW 2007-07-15 23:39:52 +00:00
parent 571bd78e58
commit 9685c65901
1 changed files with 15 additions and 9 deletions

View File

@ -17,8 +17,8 @@ namespace SimpleApp
{ {
public class MyNpcCharacter : IClientAPI public class MyNpcCharacter : IClientAPI
{ {
private uint movementDirection = 0; private uint movementFlag = 0;
private bool fly = true; private short flyState = 0;
private LLQuaternion bodyDirection = LLQuaternion.Identity; private LLQuaternion bodyDirection = LLQuaternion.Identity;
private short count = 0; private short count = 0;
@ -153,21 +153,27 @@ namespace SimpleApp
{ {
Encoding enc = Encoding.ASCII; Encoding enc = Encoding.ASCII;
this.OnAgentUpdate(this, movementDirection, bodyDirection); this.OnAgentUpdate(this, movementFlag, bodyDirection);
if (this.fly) if (this.flyState == 0)
{ {
movementDirection = (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY | (uint)MainAvatar.ControlFlags.AGENT_CONTROL_UP_NEG; movementFlag = (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY | (uint)MainAvatar.ControlFlags.AGENT_CONTROL_UP_NEG;
fly = false; flyState = 1;
}
else if (this.flyState == 1)
{
movementFlag = (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY | (uint)MainAvatar.ControlFlags.AGENT_CONTROL_UP_POS;
flyState = 2;
} }
else else
{ {
movementDirection = (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY | (uint)MainAvatar.ControlFlags.AGENT_CONTROL_UP_POS; movementFlag = (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY;
fly = true; flyState = 0;
} }
if (count >= 40) if (count >= 40)
{ {
this.OnChatFromViewer(enc.GetBytes("Kind of quiet around here isn't it! \0"), 2, new LLVector3(128, 128, 26), this.FirstName + " " + this.LastName, this.AgentId); this.OnChatFromViewer(enc.GetBytes("Kind of quiet around here, isn't it! \0"), 2, new LLVector3(128, 128, 26), this.FirstName + " " + this.LastName, this.AgentId);
count = -1; count = -1;
} }