Hi guys,
I’m using an enumeration linked to a script on the main camera. This enum is an index to know in which level of zoom I am (choices are BASE, ROOM or CHAR).
In my ZoomRoomScript attached to a room object, I handle an OnMouseDown event which zoom in from the BASE to the ROOM. And we you scroll back, the camera goes from ROOM to BASE.
I also got a ZoomCharScript, which is very similar to the ZoomRoomScript, except its linked to a character object and zooms are between ROOM and CHAR.
My problem is that in the 2 scripts, I do have differents condition to check the Scroll back, which is based on the zoom level of the Main Camera.
void Update() //ZoomRoomScript
{
if (Input.GetAxis ("Mouse ScrollWheel") < 0 && Camera.main.GetComponent<CameraScript> ().GetCurrentZoom () == CameraScript.ZoomLevel.ROOM)
{
Debug.Log("1");
// Some code
}
}
void Update() //ZoomCharScript
{
if (Input.GetAxis ("Mouse ScrollWheel") < 0 && Camera.main.GetComponent<CameraScript> ().GetCurrentZoom () == CameraScript.ZoomLevel.CHAR)
{
Debug.Log("2");
// Some code
}
}
So when I’m on the ZoomLevel.CHAR on the Main Camera, and scroll back, only the if-statement of the ZoomCharScript should be true, given the statement. But it’s not.
I always got both Debug.Log…
I don’t understand why, and I’m stucked on this for two days. If anyone have a hint/solution to this, that would be very kind.
Best regards