void Start() { system = GetComponent <SystemManager>(); camera = GetComponent <Camera>(); Instance = this; wall = walls.TOP; }
// Use this for initialization void Start () { g = new graphV[1024]; w = new walls[1024]; ax = 0; az = 0; bx = 0; bz = 0; k = 0; }
void countWall() { last = null; last2 = null; if (k == 0) { Ray myray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit help; if (Physics.Raycast(myray, out help)) { ax = Mathf.RoundToInt(help.point.x); if ((ax % 5 - 1) % 5 == 0) ax--; else if ((ax % 5 - 2) % 5 == 0) ax -= 2; else if ((ax % 5 + 2) % 5 == 0) ax += 2; else if ((ax % 5 + 1) % 5 == 0) ax++; else if ((ax % 5 + 3) % 5 == 0) ax += 3; az = Mathf.RoundToInt(help.point.z); if ((az % 5 - 1) % 5 == 0) az--; else if ((az % 5 - 2) % 5 == 0) az -= 2; else if ((az % 5 + 2) % 5 == 0) az += 2; else if ((az % 5 + 1) % 5 == 0) az++; else if ((az % 5 + 3) % 5 == 0) az += 3; } } else { Ray myray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit help; if (Physics.Raycast(myray, out help)) { bx = Mathf.RoundToInt(help.point.x); if ((bx % 5 - 1) % 5 == 0) bx--; else if ((bx % 5 - 2) % 5 == 0) bx -= 2; else if ((bx % 5 + 2) % 5 == 0) bx += 2; else if ((bx % 5 + 1) % 5 == 0) bx++; else if ((bx % 5 + 3) % 5 == 0) bx += 3; bz = Mathf.RoundToInt(help.point.z); if ((bz % 5 - 1) % 5 == 0) bz--; else if ((bz % 5 - 2) % 5 == 0) bz -= 2; else if ((bz % 5 + 2) % 5 == 0) bz += 2; else if ((bz % 5 + 1) % 5 == 0) bz++; else if ((bz % 5 + 3) % 5 == 0) bz += 3; if (Mathf.Abs(bx - ax) < Mathf.Abs(bz - az)) { bx = ax; } else { bz = az; } } } k++; if (k == 2) { k = 0; float aax = ax; float aaz = az; float bbx = bx; float bbz = bz; var W = GameObject.Instantiate(GameObject.Find("/Wall")); W.transform.position = new Vector3((aax + bbx) / 2, 0, (aaz + bbz) / 2); if (ax == bx) { W.transform.localScale = new Vector3(0.1f, 6, Mathf.Abs(bz - az)); w[wk] = new walls(); w[wk].x = (aax + bbx) / 2; w[wk].z = (aaz + bbz) / 2; w[wk].sx = 0.1f; w[wk].sz = Mathf.Abs(bz - az); wk++; } else { W.transform.localScale = new Vector3(Mathf.Abs(bx - ax), 6, 0.1f); w[wk] = new walls(); w[wk].x = (aax + bbx) / 2; w[wk].z = (aaz + bbz) / 2; w[wk].sx = Mathf.Abs(bx - ax); w[wk].sz = 0.1f; wk++; } } }
void countDoor() { Ray myray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit help; if (Physics.Raycast(myray, out help)) { ax = Mathf.RoundToInt(help.point.x); if ((ax % 5 - 1) % 5 == 0) ax--; else if ((ax % 5 - 2) % 5 == 0) ax -= 2; else if ((ax % 5 + 2) % 5 == 0) ax += 2; else if ((ax % 5 + 1) % 5 == 0) ax++; else if ((ax % 5 + 3) % 5 == 0) ax += 3; az = Mathf.RoundToInt(help.point.z); if ((az % 5 - 1) % 5 == 0) az--; else if ((az % 5 - 2) % 5 == 0) az -= 2; else if ((az % 5 + 2) % 5 == 0) az += 2; else if ((az % 5 + 1) % 5 == 0) az++; else if ((az % 5 + 3) % 5 == 0) az += 3; } if (k == 0) { var W = GameObject.Instantiate(GameObject.Find("/Wall")); last = W; W.transform.position = new Vector3(ax - 3.5f, 0, az); W.transform.localScale = new Vector3(3, 6, 0.1f); w[wk] = new walls(); w[wk].x = ax - 3.5f; w[wk].z = az; w[wk].sx = 3; w[wk].sz = 0.1f; wk++; W = GameObject.Instantiate(GameObject.Find("/Wall")); W.transform.position = new Vector3(ax + 3.5f, 0, az); W.transform.localScale = new Vector3(3, 6, 0.1f); w[wk] = new walls(); w[wk].x = ax + 3.5f; w[wk].z = az; w[wk].sx = 3; w[wk].sz = 0.1f; wk++; last2 = W; } else { var W = GameObject.Instantiate(GameObject.Find("/Wall")); last = W; W.transform.position = new Vector3(ax, 0, az - 3.5f); W.transform.localScale = new Vector3(0.1f, 6, 3); w[wk] = new walls(); w[wk].x = ax; w[wk].z = az - 3.5f; w[wk].sx = 0.1f; w[wk].sz = 3; wk++; W = GameObject.Instantiate(GameObject.Find("/Wall")); W.transform.position = new Vector3(ax, 0, az + 3.5f); W.transform.localScale = new Vector3(0.1f, 6, 3); w[wk] = new walls(); w[wk].x = ax; w[wk].z = az + 3.5f; w[wk].sx = 0.1f; w[wk].sz = 3; wk++; last2 = W; } }
public Walls(walls wall) { w = wall; }
// Update is called once per frame void Update() { #region 設定モードのオンオフ if ((Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl)) && Input.GetKeyDown(KeyCode.D)) { if (settingMode == false) { settingMode = true; debugText.SetActive(true); } else { settingMode = false; debugText.SetActive(false); } } #endregion #region 設定モード if (settingMode == true) { //一時停止 if (Input.GetKeyUp(KeyCode.Space)) { stop = stop ? false : true; Time.timeScale = stop ? 0 : 1; } #region keyword Weightの調整 if (Input.GetKeyDown(KeyCode.K)) { PhotoManager.Instance.color.weight_--; } #endregion #region カラーで寄ってくる写真の数 if (Input.GetKeyDown(KeyCode.F)) { AttractorColor.photoNum++; DebugText.texts.follower = AttractorColor.photoNum.ToString(); } if (Input.GetKeyDown(KeyCode.U) && AttractorColor.photoNum > 0) { AttractorColor.photoNum--; DebugText.texts.follower = AttractorColor.photoNum.ToString(); } #endregion #region ズームのON-OFF if (Input.GetKeyDown(KeyCode.Z)) { DebugText.texts.doubleClick = SystemManager.zoomEnabled ? "OFF" : "ON"; SystemManager.zoomEnabled = SystemManager.zoomEnabled ? false : true; } #endregion #region perspectiveでの画像へのタッチインタラクションのON-OFF if (Input.GetKeyDown(KeyCode.I)) { DebugText.texts.interactive = SystemManager.interactiveEnabled ? "OFF" : "ON"; SystemManager.interactiveEnabled = SystemManager.interactiveEnabled ? false : true; if (SystemManager.interactiveEnabled == false) { inputField.SetActive(true); } else { inputField.SetActive(false); } } #endregion #region canvas scaler のscaleFactor調整用 if (Input.GetKeyDown(KeyCode.P)) { GameObject.Find("Canvas").gameObject.GetComponent <Canvas>().scaleFactor += 0.1f; DebugText.texts.scaleFactor = GameObject.Find("Canvas").gameObject.GetComponent <Canvas>().scaleFactor.ToString("0.0"); } if (Input.GetKeyDown(KeyCode.N)) { GameObject.Find("Canvas").gameObject.GetComponent <Canvas>().scaleFactor -= 0.1f; DebugText.texts.scaleFactor = GameObject.Find("Canvas").gameObject.GetComponent <Canvas>().scaleFactor.ToString("0.0"); } #endregion #region wall if (Input.GetKeyDown(KeyCode.T)) { wall = walls.TOP; } else if (Input.GetKeyDown(KeyCode.B)) { wall = walls.BOTTOM; } else if (Input.GetKeyDown(KeyCode.R)) { wall = walls.RIGHT; } else if (Input.GetKeyDown(KeyCode.L)) { wall = walls.LEFT; } if (Input.GetKeyUp(KeyCode.UpArrow)) { switch (wall) { case walls.TOP: AutoDisplayAdjuster.topOffset += 0.1f; DebugText.texts.topOffset = AutoDisplayAdjuster.topOffset.ToString("0.0"); break; case walls.BOTTOM: AutoDisplayAdjuster.bottomOffset += 0.1f; DebugText.texts.bottomOffset = AutoDisplayAdjuster.bottomOffset.ToString("0.0"); break; case walls.RIGHT: AutoDisplayAdjuster.rightOffset += 0.1f; DebugText.texts.rightOffset = AutoDisplayAdjuster.rightOffset.ToString("0.0"); break; case walls.LEFT: AutoDisplayAdjuster.leftOffset += 0.1f; DebugText.texts.leftOffset = AutoDisplayAdjuster.leftOffset.ToString("0.0"); break; } } if (Input.GetKeyUp(KeyCode.DownArrow)) { switch (wall) { case walls.TOP: if (AutoDisplayAdjuster.topOffset > 0.1f) { AutoDisplayAdjuster.topOffset -= 0.1f; DebugText.texts.topOffset = AutoDisplayAdjuster.topOffset.ToString("0.0"); } break; case walls.BOTTOM: if (AutoDisplayAdjuster.bottomOffset > 0.1f) { AutoDisplayAdjuster.bottomOffset -= 0.1f; DebugText.texts.bottomOffset = AutoDisplayAdjuster.bottomOffset.ToString("0.0"); } break; case walls.RIGHT: if (AutoDisplayAdjuster.rightOffset > 0.1f) { AutoDisplayAdjuster.rightOffset -= 0.1f; DebugText.texts.rightOffset = AutoDisplayAdjuster.rightOffset.ToString("0.0"); } break; case walls.LEFT: if (AutoDisplayAdjuster.leftOffset > 0.1f) { AutoDisplayAdjuster.leftOffset -= 0.1f; DebugText.texts.leftOffset = AutoDisplayAdjuster.leftOffset.ToString("0.0"); } break; } } #endregion } #endregion if ((SystemManager.systemState & SystemManager.SystemState.MAIN) == SystemManager.SystemState.MAIN) { if ((SystemManager.cameraState & SystemManager.CameraState.ORTHOGRAPHIC) == SystemManager.CameraState.ORTHOGRAPHIC) { } else if ((SystemManager.cameraState & SystemManager.CameraState.PERSPECTIVE) == SystemManager.CameraState.PERSPECTIVE) { #region マウス if (SystemManager.interactiveEnabled == true) { if (Input.GetMouseButtonDown(2)) { last = Input.mousePosition; } if (Input.GetMouseButton(2)) { CameraTransform(Input.mousePosition); } } #endregion } } }