void Update() { //Place a face. <AL> if (Input.GetKeyDown(KeyCode.Return)) { pos = cam.GetState(); floor = cam.GetFloor(); ToBePlaced = TowerFaces[Random.Range(1, 4)]; ToBePlaced.gameObject.transform.localScale = new Vector3(2.5f, 2.65f, 1f); //Face placing per side per floor. <AL> if (pos == 2) { if (FacesPlaced[pos, floor] == 0) { Instantiate(ToBePlaced, new Vector3(11f, (-4.3f + 4.1f * floor * 2f), -10f), Quaternion.Euler(0, 90, 0)); FacesPlaced[pos, floor]++; } } else if (pos == 4) { if (FacesPlaced[pos, floor] == 0) { Instantiate(ToBePlaced, new Vector3(10f, (-4.3f + 4.1f * floor * 2f), 11f), Quaternion.Euler(0, 0, 0)); FacesPlaced[pos, floor]++; } } else if (pos == 6) { if (FacesPlaced[pos, floor] == 0) { Instantiate(ToBePlaced, new Vector3(-11f, (-4.3f + 4.1f * floor * 2f), 10f), Quaternion.Euler(0, 270, 0)); FacesPlaced[pos, floor]++; } } else if (pos == 8) { if (FacesPlaced[pos, floor] == 0 && floor != 0) { Instantiate(ToBePlaced, new Vector3(-10f, (-4.3f + 4.1f * floor * 2f), -11f), Quaternion.Euler(0, 180, 0)); FacesPlaced[pos, floor]++; } } } if (Input.GetKeyDown(KeyCode.L)) { //For debugging. Shows me position, floor, and array data in console. Remove when unneeded. <AL> pos = cam.GetState(); floor = cam.GetFloor(); print("Pos: " + pos + "," + "Floor: " + floor + ", Array: " + FacesPlaced[pos, floor]); } }
private void Start() { bottomPlayer = GameObject.Find("Player 1").GetComponent <CameraOneRotator>(); topPlayer = GameObject.Find("Player 2 Camera").GetComponent <CameraTwoRotator>(); floor = topPlayer.GetFloor(); face = topPlayer.GetState(); }
private void GetTopPlayerPosition() { int floor = camTwo.GetFloor(); float position = 1 - (((float)numberOfFloors.NumFloors - (float)floor) / (float)numberOfFloors.NumFloors); topPlayerImage.rectTransform.anchoredPosition = new Vector3(topPlayerImage.rectTransform.anchoredPosition.x, highestMinimapPoint * position - (highestMinimapPoint / numberOfFloors.NumFloors), 0); topText.text = "TOP: " + floor; }