// Use this for initialization void Start() { //player = gameObject.transform.GetComponentInParent<UnitBehavior>(); // added to link the camera to the parent with the unitbehavior script clientPlayers = new List <UnitBehavior>(); clientPlayers.Add(player); //add connected players somehow???? targetPosition = player.transform.position; player.SetOverworldDestination(targetPosition); ClickEffect = GameObject.Instantiate(ClickObject, targetPosition, Quaternion.identity); mouseHeld = false; CameraControllerOfflineScript playerCameraScript = mainCamera.GetComponent <CameraControllerOfflineScript>(); if (playerCameraScript != null) { playerCameraScript.Target = player.gameObject; } }
// Update is called once per frame void Update() { if (minimapcamcontroller != null) { //set minimap's target to the main camera's player object. minimapcamcontroller.Target = Camera.main.GetComponent <CameraControllerOfflineScript>().Target; TargetDisplay.transform.position = Camera.main.GetComponent <CameraControllerOfflineScript>().Target.transform.position + Vector3.up * (1.1f); //set minimap's target2 to the main camera's 2nd target. minimapcamcontroller.Target2 = Camera.main.GetComponent <CameraControllerOfflineScript>().Target2; minimapcam.backgroundColor = _Unrevealed; } else { //get the minimap camera minimapcam = GameObject.Find("MinimapCamera").GetComponent <Camera>(); //get that camera's control script minimapcamcontroller = minimapcam.GetComponent <CameraControllerOfflineScript>(); } /* * //when the floor is finished creating itself, apply color changes * if (floor != null) { * if (!hasGivenColors & floor.FloorSize == floor.PathSize ) * { * //set the scale of our target display * TargetDisplay.transform.localScale = new Vector3(floor.roomWidth/4, floor.roomWidth/4, floor.roomWidth/4); * hasGivenColors = true; * foreach (WRoom o in floor.map) * { * o._Unrevealed = _Unrevealed; * o._Revealed = _Revealed; * o._NotCleared = _NotCleared; * o._Visited = _Visited; * o.minirend.material = mat; * } * } * } * else * { * //get the floor. * floor = GameObject.Find("DungeonController").GetComponent<DungeonManager>().myfloor; * } */ }
/// <summary> /// changes color of the room's roof object based on relative position. /// also changes the floor flags for the minimap class to use /// </summary> void UpdateRoofing() { if (target == null || target.model == null) { //Debug.Log("target or target model is null, so no roof to update."); return; } foreach (WRoom o in myfloor.map) { o.SetVisionColor(UnvisibleColor); o.SetActive(false); } //now we have a target, make the target room's roof clear, and the connection rooms semi-clear target.SetActive(true); //target.model.transform.Find("Roof").GetComponent<Renderer>().material.SetColor("_MainColor", CurrentRoomColor); target.SetVisionColor(CurrentRoomColor); //set hasbeenrevealed for this object which the player is now in. target.hasBeenRevealed = true; //set hasbeenvisited for this object which the player is now in. target.hasBeenVisited = true; CameraControllerOfflineScript cam = GameObject.Find("Camera").GetComponent <CameraControllerOfflineScript>(); cam.Target2 = target.model; UnitBehavior unit = playerObject.GetComponent <UnitBehavior>(); if (unit != null) { cam.SetBattle(unit.inBattle); //lets the camera know whether to zoom out or not. } for (int i = 0; i < 4; i++) { if (target.connections[i] != null) { //target.connections[i].model.transform.Find("Roof").GetComponent<Renderer>().material.SetColor("_MainColor", ConnectedRoomColor); target.connections[i].SetActive(true); target.connections[i].SetVisionColor(ConnectedRoomColor); //since this connected room is partially revealed, reflect this in the map. target.connections[i].hasBeenRevealed = true; } } }