Look:
Code: Select all
if(e.Type == EventType.MouseInput)
{
bool wantTake = false;
if(e.MouseInputType == MouseInputEvent.MouseMoved) //Cursor Change on over
{
if(m_camera == null)
return false;
if(m_camera.getCamera() == null)
return false;
Line3D ray = m_manager.SceneCollisionManager.GetRayFromScreenCoordinates(m_device.CursorControl.Position,m_camera.getCamera());
ISceneNode nodeSelected = m_manager.SceneCollisionManager.GetSceneNodeFromRayBB(ray,0);
if(nodeSelected == null)
return false;
if(nodeSelected.ID >= 400) //ID Item
{
wantTake=true;
}
}
else if(e.MouseInputType == MouseInputEvent.PressedDownLeft) //Selection of the billboard/item
{
Line3D ray = m_manager.SceneCollisionManager.GetRayFromScreenCoordinates(m_device.CursorControl.Position,m_camera.getCamera());
ISceneNode nodeSelected = m_manager.SceneCollisionManager.GetSceneNodeFromRayBB(ray,0);
if(nodeSelected == null)
return false;
if(nodeSelected.ID >= 400) //ID Item
{
Console.WriteLine("Click sur item !!");
foreach(Item item in m_itemsInMap)
{
if(item.id_Compare == nodeSelected.ID)
{
Console.WriteLine("Item ID: "+item.id.ToString());
m_clientNetwork.clickItemEvent(item.id);
}
}
}
}
if(wantTake)
cursorstate = CursorState.WantTake;