Hi,
I’ve a theoretical (and consequently pratical) problem concerning how to manage a specific interaction between some “stuff” in coding.
I instantiate via code (C#) everything in my game but the terrain, main camera and again 3 or 4 other objects; everything else is coded: objects recalling prefs, GUIs, behaviours and so on.
Now… I have a vehicle and I want to set a new route to this vehicle. When you double click on the vehicle a window appears with all vehicle’s data and some buttons to control some actions (start, stop, more info etc.) and 2 “special buttons”: “Set starting point” and “Set ending point”.
I desire the following behaviour:
- I click on "Set starting position"
- I click on another object on the map
- The vehicle now has its starting point set
Please consider that my onMouseUp() function associated on my map objects is as follows:
MapObject OnMouseUp()
{
if ((Time.time - doubleClickStart) < GlobalVariables.WindowDblClickDelay)
{
OnDoubleClick();
doubleClickStart = -1;
}
else
{
doubleClickStart = Time.time;
}
return this.mapObject;
}
This means that I don't care the exact point where the player will click, but the object (it will bring every info with itself).
I'm not sure how I have to proceed.
What shall I do? Handlers? Listeners? Raycast using?