private void adjustCamSize() { Debug.Log("Adjusting camera size to screen height: " + Screen.height); gameObject.GetComponent <Camera> ().orthographicSize = Screen.height / 4; GRenderEventManager.TriggerEvent("CamPositionChange"); //GameRenderer.GRenderer.ScheduleUpdateOnAllObjects(RenderObjectUpdateOperations.UPDATE_POSITION); }
// Update is called once per frame void FixedUpdate() { /*float speed = 1f; * if(Input.GetKey(KeyCode.LeftShift)) { * speed = 2f; * } * if(Input.GetKey(KeyCode.UpArrow)) { * moveTargetTemp(Vector2.up*speed); * } * if(Input.GetKey(KeyCode.LeftArrow)) { * moveTargetTemp(Vector2.right*-1*speed); * } * if(Input.GetKey(KeyCode.DownArrow)) { * moveTargetTemp(Vector2.up*-1*speed); * } * if(Input.GetKey(KeyCode.RightArrow)) { * moveTargetTemp(Vector2.right*speed); * }*/ //transform.position = new Vector3 (Mathf.FloorToInt(transform.position.x), Mathf.FloorToInt(transform.position.y), Mathf.FloorToInt(transform.position.z)); //transform.position = new Vector3 (GameData.FocusPoint.x, GameData.FocusPoint.y, camDepth); if (last_position != transform.position) // camera position changed { GRenderEventManager.TriggerEvent("CamPositionChange"); last_position = transform.position; } /*if (Input.GetKeyDown (KeyCode.P)) { * adjustCamSize(); * }*/ if (Input.GetKeyDown(KeyCode.LeftControl)) { if (zoom_level > 1) { zoom_level = 0; } else { zoom_level++; } adjustCamSize(zoom_level); } }
private void adjustCamSize(int zoom) { int zoom_coeficient = 0; switch (zoom) { case 0: zoom_coeficient = 2; break; case 1: zoom_coeficient = 4; break; case 2: zoom_coeficient = 8; break; } gameObject.GetComponent <Camera> ().orthographicSize = Screen.height / zoom_coeficient; GRenderEventManager.TriggerEvent("CamPositionChange"); }
void StopListeners() { GRenderEventManager.StopListening("CamPositionChange", CamPositionChange_Listener); }