void reciveZDB(ZDB newZoom){// add new ZDB to the queue ////Debug.Log(newZoom.name); //zoomQueue.Enqueue(newZoom); Deactivate(); zoomList.Add(newZoom); Activate (); }
void reciveZDB(ZDB newZoom) // add new ZDB to the queue ////Debug.Log(newZoom.name); //zoomQueue.Enqueue(newZoom); { Deactivate(); zoomList.Add(newZoom); Activate(); }
void Deactivate() // deactivate current ZDB { if (zoomList.Count != 0) // make sure we have a zoom to deactivate first //ZDB temp = zoomQueue.Peek() as ZDB;// use the latest zoom { ZDB temp = zoomList[zoomList.Count - 1]; if (temp.uses_puzzel) { if (temp.current_manager != null) { temp.current_manager.Active(false); // activate the current pussel-manager } else { //Debug.LogError("Pussel-manager couldn't be activated"); } } GameObject.Find(temp.name).GetComponent <GUI_Parent>().Activate(false); // activates the GUI-components of the current zoom. if (zoomList.Count == 1) { //Debug.Log("You left the zoom"); GameObject.Find("MasterMind").SendMessage("SetIsPuzzle", false); // Let the input manager know we are in a puzzel. } //------------------------- cam_ref.gameObject.SetActive(true); //cam_ref.GetComponent<AudioListener>().enabled = true; //temp.zoom_cam.GetComponent<AudioListener>().enabled = false; temp.zoom_cam.gameObject.SetActive(false); // = false; //------------------------- CameraChangePos messenger = new CameraChangePos(); /* Change the camera position and let it know we are in puzzel mode */ //messenger.pos = temp.deactive_pos; 0, /* Uses a struct with a position and a bool as a data messenger */ messenger.pos = Camera.main.transform.position; messenger.isPuzzle = (zoomList.Count == 1 ? false : true); /* */ //cam_ref.SendMessage("SetPos", false); // the new camera position is set. //cam_ref.SendMessage("SetZoom", false); // the new camera position is set. DeacitivateCurrent(); // remove the deactive zoom from the manager. if (zoomList.Count != 0) // if there is another { Activate(); } else { //Debug.Log ("Can't deactivate the zoom because the is no zoom active (the queue is empty)"); } } }
ZDB Create_ZDB()// creates a ZoomDataBlock { ZDB zoom = new ZDB(); zoom.deactive_pos = Camera.main.transform.position; zoom.active_pos = childObject.transform.position; zoom.name = name; zoom.zoom_cam = Puzzel_cam; zoom.uses_puzzel = uses_puzzel; if(current_Manager != null){ zoom.current_manager= current_Manager; }else{ //Debug.LogWarning("puzzel_Manager not used"); } return zoom; }
ZDB Create_ZDB() // creates a ZoomDataBlock { ZDB zoom = new ZDB(); zoom.deactive_pos = Camera.main.transform.position; zoom.active_pos = childObject.transform.position; zoom.name = name; zoom.zoom_cam = Puzzel_cam; zoom.uses_puzzel = uses_puzzel; if (current_Manager != null) { zoom.current_manager = current_Manager; } else { //Debug.LogWarning("puzzel_Manager not used"); } return(zoom); }
/*void ShiftFocus(){// set focus to the current ZDB (set camera etc) * * }*/ //*************************** Look over the camera shifting with the new way of creating cameras. ******************************************* void Activate() // activate current ZDB { if (zoomList.Count == 1) // we only need to say we are in a puzzel the firt time we enter one, not when we go deeper into the puzzel/zoom //Debug.Log("You entered the zoom"); { GameObject.Find("MasterMind").SendMessage("SetIsPuzzle", true); // Let the input manager know we are in a puzzel. } //ZDB temp = zoomQueue.Peek() as ZDB;// use the latest zoom ZDB temp = zoomList[zoomList.Count - 1]; //-------------------- temp.zoom_cam.gameObject.SetActive(true); // ! might need a more solid approch but for now this works ! //temp.zoom_cam.GetComponent<AudioListener>().enabled = true; //cam_ref.GetComponent<AudioListener>().enabled = false; cam_ref.gameObject.SetActive(false); // = false; //-------------------- //CameraChangePos messenger = new CameraChangePos(); /* Change the camera position and let it know we are in puzzel mode */ //messenger.pos = temp.active_pos; /* Uses a struct with a position and a bool as a data messenger */ //messenger.pos = Camera.main.transform.position; //messenger.isPuzzle = true; /* */ //cam_ref.SendMessage("SetPos", true); // the new camera position is set. //cam_ref.SendMessage("SetZoom", true); // the new camera position is set. GameObject.Find(temp.name).GetComponent <GUI_Parent>().Activate(true); // activates the GUI-components of the current zoom. if (temp.uses_puzzel) { if (temp.current_manager != null) { temp.current_manager.Active(true); // activate the current pussel-manager } else { //Debug.LogError("Pussel-manager couldn't be activated"); } } }
void Activate(){ zoomInfo = Create_ZDB(); send_ZDB(); childObject.transform.parent.SendMessage("ActivateStuff",SendMessageOptions.DontRequireReceiver); }
void Activate() { zoomInfo = Create_ZDB(); send_ZDB(); childObject.transform.parent.SendMessage("ActivateStuff", SendMessageOptions.DontRequireReceiver); }