Hi
i need to know if that enough to ReDraw the new marker position ? it doesnt redraw the marker with the new position .. if this device is in a moiving car it should show the marker moving on the master screen after sending this RPC Function ?!!
private void OnLocationChanged(Vector2 position)
{
MPV = Add_Room.go_to_Player_room.GetComponent<PhotonView>();
// Change the position of the marker.
playerMarker.position = position;
First_Connection.GClass.The_Marker[0].marker.position = position;
First_Connection.GClass.The_Marker[0].Latitude = position.y;
First_Connection.GClass.The_Marker[0].Longtude = position.x;
First_Connection.GClass.The_Marker[0].position = position;
//First_Connection.GClass.The_Marker[0].marker.position = position;
OnlineMaps.instance.Redraw();
if (First_Connection.MC.PI.Player_Is_Master == false)
MPV.RPC("SendMyLoacationToMaster", RpcTarget.MasterClient, position, Load_Rooms.Player_Name);
and the RPC function is :
[PunRPC]
private void SendMyLoacationToMaster(Vector2 Position,string name)
{
int found = 0;
if (First_Connection.MC.PI.Player_Is_Master == false)
{
for (int i = 0; i < First_Connection.GClass.The_Driver.Count; i++)
{
if (First_Connection.GClass.The_Driver[i ].Driver_Name == name)
{
First_Connection.GClass.The_Driver[i ].position = Position;
First_Connection.GClass.The_Driver[i ].marker.position = Position;
Debug.Log("Send My Locateion To Master : " + First_Connection.GClass.The_Driver[i ].Driver_Name);
found = 1;
//return;
}
}
if (found == 0)
{
Driver driver = new Driver();
Texture2D txtr;
txtr = Resources.Load("c620c6b7a2b0e22a05e179ed8e7ab6b0_icon") as Texture2D;
// txtr = Resources.Load("Taxi") as Texture2D;
//OnlineMapsLocationService locationService = OnlineMapsLocationService.instance;
// Create a new marker.
driver.marker = OnlineMapsMarkerManager.CreateItem(Position, txtr, name);
//playerMarker.align = OnlineMapsAlign.Center;
driver.latitude = Position.y;
driver.longtude = Position.x;
driver.position = Position;
driver.Driver_Found_And_Updated = false;
driver.Driver_Not_Found_Counter = 0;
//driver.marker = playerMarker;
driver.Time_Enter_Room = System.DateTime.Now;
driver.Time_He_Push_Free = System.DateTime.Now;
Debug.Log("Marker Created Successfully......");
driver.Driver_Name = name;
First_Connection.GClass.The_Driver.Add(driver);
}
OnlineMaps.instance.Redraw();
}
}