| 40 |
|
|
| 41 |
namespace OpenSim.Region.Examples.RexBot |
namespace OpenSim.Region.Examples.RexBot |
| 42 |
{ |
{ |
| 43 |
public class RexBot : GenericNpcCharacter, IRexBot, IClientCore |
public class RexBot : GenericNpcCharacter, IRexBot, IClientAPI, IRexClientCore, IClientRexAppearance, IClientCore |
| 44 |
{ |
{ |
| 45 |
public enum RexBotState { Idle, Walking, Flying, Unknown } |
public enum RexBotState { Idle, Walking, Flying, Unknown } |
| 46 |
|
|
| 80 |
private NavMeshManager m_navMeshManager; |
private NavMeshManager m_navMeshManager; |
| 81 |
private NavMeshInstance m_navMesh; |
private NavMeshInstance m_navMesh; |
| 82 |
|
|
|
#pragma warning disable 67 |
|
| 83 |
public event RexAppearanceDelegate OnRexAppearance; |
public event RexAppearanceDelegate OnRexAppearance; |
| 84 |
public event RexGenericMessageDelegate OnRexFaceExpression; |
public event RexStartUpDelegate OnRexStartUp; |
| 85 |
public event ReceiveRexMediaURL OnReceiveRexMediaURL; |
public event RexClientScriptCmdDelegate OnRexClientScriptCmd; |
|
#pragma warning restore 67 |
|
| 86 |
|
|
| 87 |
private string m_rexAccountID; |
private string m_rexAccountID; |
| 88 |
private string m_rexAvatarURL; |
private string m_rexAvatarURL; |
| 658 |
|
|
| 659 |
public void SetBotAppearance(string address) |
public void SetBotAppearance(string address) |
| 660 |
{ |
{ |
| 661 |
if(m_scenePresence.ControllingClient is IRexClientAPI) |
if (m_scenePresence.ControllingClient is IClientRexAppearance) |
| 662 |
((IRexClientAPI)m_scenePresence.ControllingClient).RexAvatarURLOverride = address; |
((IClientRexAppearance)m_scenePresence.ControllingClient).RexAvatarURLOverride = address; |
| 663 |
} |
} |
| 664 |
|
|
| 665 |
public void DisableWalk(bool disable) |
public void DisableWalk(bool disable) |
| 666 |
{ |
{ |
| 667 |
if(m_scenePresence.ControllingClient is IRexClientAPI) |
if (m_scenePresence.ControllingClient is IRexClientCore) |
| 668 |
((IRexClientAPI)m_scenePresence.ControllingClient).RexWalkDisabled = disable; |
((IRexClientCore)m_scenePresence.ControllingClient).RexWalkDisabled = disable; |
| 669 |
} |
} |
| 670 |
|
|
| 671 |
public void SetMovementSpeedMod(float speed) |
public void SetMovementSpeedMod(float speed) |
| 672 |
{ |
{ |
| 673 |
if (m_scenePresence.ControllingClient is IRexClientAPI) |
if (m_scenePresence.ControllingClient is IRexClientCore) |
| 674 |
((IRexClientAPI)m_scenePresence.ControllingClient).RexMovementSpeedMod = speed; |
((IRexClientCore)m_scenePresence.ControllingClient).RexMovementSpeedMod = speed; |
| 675 |
} |
} |
| 676 |
|
|
| 677 |
public void SetVertMovementSpeedMod(float speed) |
public void SetVertMovementSpeedMod(float speed) |
| 678 |
{ |
{ |
| 679 |
if (m_scenePresence.ControllingClient is IRexClientAPI) |
if (m_scenePresence.ControllingClient is IRexClientCore) |
| 680 |
((IRexClientAPI)m_scenePresence.ControllingClient).RexVertMovementSpeedMod = speed; |
((IRexClientCore)m_scenePresence.ControllingClient).RexVertMovementSpeedMod = speed; |
| 681 |
} |
} |
| 682 |
|
|
| 683 |
private bool m_adminMode; |
private bool m_adminMode; |
| 840 |
get { return m_scene; } |
get { return m_scene; } |
| 841 |
} |
} |
| 842 |
|
|
|
public void SendRexFaceExpression(List<string> expressionData){ } |
|
| 843 |
public void SendRexAppearance(UUID agentID, string avatarURL){ } |
public void SendRexAppearance(UUID agentID, string avatarURL){ } |
|
public void SendMediaURL(UUID assetId, string mediaURL, byte refreshRate) { } |
|
| 844 |
|
|
| 845 |
|
|
| 846 |
|
#region IClientCore Members |
| 847 |
|
|
| 848 |
|
private readonly Dictionary<Type, object> m_clientInterfaces = new Dictionary<Type, object>(); |
| 849 |
|
|
| 850 |
|
public T Get<T>() |
| 851 |
|
{ |
| 852 |
|
return (T)m_clientInterfaces[typeof(T)]; |
| 853 |
|
} |
| 854 |
|
|
| 855 |
public bool TryGet<T>(out T iface) |
public bool TryGet<T>(out T iface) |
| 856 |
{ |
{ |
| 857 |
|
if (m_clientInterfaces.ContainsKey(typeof(T))) |
| 858 |
|
{ |
| 859 |
|
iface = (T)m_clientInterfaces[typeof(T)]; |
| 860 |
|
return true; |
| 861 |
|
} |
| 862 |
iface = default(T); |
iface = default(T); |
| 863 |
return false; |
return false; |
| 864 |
} |
} |
| 865 |
|
|
| 866 |
public T Get<T>() |
protected virtual void RegisterInterfaces() |
| 867 |
{ |
{ |
| 868 |
return default(T); |
RegisterInterface<IRexBot>(this); |
| 869 |
|
RegisterInterface<IClientAPI>(this); |
| 870 |
|
RegisterInterface<IRexClientCore>(this); |
| 871 |
|
RegisterInterface<IClientRexAppearance>(this); |
| 872 |
|
RegisterInterface<RexBot>(this); |
| 873 |
} |
} |
| 874 |
|
|
| 875 |
|
protected void RegisterInterface<T>(T iface) |
| 876 |
|
{ |
| 877 |
|
lock (m_clientInterfaces) |
| 878 |
|
{ |
| 879 |
|
if (!m_clientInterfaces.ContainsKey(typeof(T))) |
| 880 |
|
{ |
| 881 |
|
m_clientInterfaces.Add(typeof(T), iface); |
| 882 |
|
} |
| 883 |
|
} |
| 884 |
|
} |
| 885 |
|
|
| 886 |
|
#endregion |
| 887 |
} |
} |
| 888 |
} |
} |