private void Generate1st() { GameObject go; Object obj = SelectPrefab.SolidHex(colorList [0]); if (size1 > 0) { go = GameObject.Instantiate(obj, CoordinateConversions.CubeToSquare(s11 [0], s11 [1], s11 [2]), Quaternion.identity) as GameObject; go.name = "1-1"; } else { return; } if (size1 > 1) { go = GameObject.Instantiate(obj, CoordinateConversions.CubeToSquare(s12 [0], s12 [1], s12 [2]), Quaternion.identity) as GameObject; go.name = "1-2"; } else { return; } if (size1 > 2) { go = GameObject.Instantiate(obj, CoordinateConversions.CubeToSquare(s13 [0], s13 [1], s13 [2]), Quaternion.identity) as GameObject; go.name = "1-3"; } else { return; } if (size1 > 3) { go = GameObject.Instantiate(obj, CoordinateConversions.CubeToSquare(s14 [0], s14 [1], s14 [2]), Quaternion.identity) as GameObject; go.name = "1-4"; } else { return; } if (size1 > 4) { go = GameObject.Instantiate(obj, CoordinateConversions.CubeToSquare(s15 [0], s15 [1], s15 [2]), Quaternion.identity) as GameObject; go.name = "1-5"; } else { return; } if (size1 > 5) { go = GameObject.Instantiate(obj, CoordinateConversions.CubeToSquare(s16 [0], s16 [1], s16 [2]), Quaternion.identity) as GameObject; go.name = "1-5"; } else { return; } }
private void Generate5th() { GameObject go; Object obj = SelectPrefab.SolidHex(colorList [4]); if (size5 > 0) { go = GameObject.Instantiate(obj, CoordinateConversions.CubeToSquare(s51 [0], s51 [1], s51 [2]), Quaternion.identity) as GameObject; go.name = "5-1"; } else { return; } if (size5 > 1) { go = GameObject.Instantiate(obj, CoordinateConversions.CubeToSquare(s52 [0], s52 [1], s52 [2]), Quaternion.identity) as GameObject; go.name = "5-2"; } else { return; } if (size5 > 2) { go = GameObject.Instantiate(obj, CoordinateConversions.CubeToSquare(s53 [0], s53 [1], s53 [2]), Quaternion.identity) as GameObject; go.name = "5-3"; } else { return; } if (size5 > 3) { go = GameObject.Instantiate(obj, CoordinateConversions.CubeToSquare(s54 [0], s54 [1], s54 [2]), Quaternion.identity) as GameObject; go.name = "5-4"; } else { return; } if (size5 > 4) { go = GameObject.Instantiate(obj, CoordinateConversions.CubeToSquare(s55 [0], s55 [1], s55 [2]), Quaternion.identity) as GameObject; go.name = "5-5"; } else { return; } if (size5 > 5) { go = GameObject.Instantiate(obj, CoordinateConversions.CubeToSquare(s56 [0], s56 [1], s56 [2]), Quaternion.identity) as GameObject; go.name = "5-6"; } else { return; } }
private void Generate6th() { GameObject go; Object obj = SelectPrefab.SolidHex(colorList [5]); if (size6 > 0) { go = GameObject.Instantiate(obj, CoordinateConversions.CubeToSquare(s61 [0], s61 [1], s61 [2]), Quaternion.identity) as GameObject; go.name = "6-1"; } else { return; } if (size6 > 1) { go = GameObject.Instantiate(obj, CoordinateConversions.CubeToSquare(s62 [0], s62 [1], s62 [2]), Quaternion.identity) as GameObject; go.name = "6-2"; } else { return; } if (size6 > 2) { go = GameObject.Instantiate(obj, CoordinateConversions.CubeToSquare(s63 [0], s63 [1], s63 [2]), Quaternion.identity) as GameObject; go.name = "6-3"; } else { return; } if (size6 > 3) { go = GameObject.Instantiate(obj, CoordinateConversions.CubeToSquare(s64 [0], s64 [1], s64 [2]), Quaternion.identity) as GameObject; go.name = "6-4"; } else { return; } if (size6 > 4) { go = GameObject.Instantiate(obj, CoordinateConversions.CubeToSquare(s65 [0], s65 [1], s65 [2]), Quaternion.identity) as GameObject; go.name = "6-5"; } else { return; } if (size6 > 5) { go = GameObject.Instantiate(obj, CoordinateConversions.CubeToSquare(s66 [0], s66 [1], s66 [2]), Quaternion.identity) as GameObject; go.name = "6-6"; } else { return; } }
private void Generate4th() { GameObject go; Object obj = SelectPrefab.SolidHex(colorList [3]); if (size4 > 0) { go = GameObject.Instantiate(obj, CoordinateConversions.CubeToSquare(s41 [0], s41 [1], s41 [2]), Quaternion.identity) as GameObject; go.name = "4-1"; } else { return; } if (size4 > 1) { go = GameObject.Instantiate(obj, CoordinateConversions.CubeToSquare(s42 [0], s42 [1], s42 [2]), Quaternion.identity) as GameObject; go.name = "4-2"; } else { return; } if (size4 > 2) { go = GameObject.Instantiate(obj, CoordinateConversions.CubeToSquare(s43 [0], s43 [1], s43 [2]), Quaternion.identity) as GameObject; go.name = "4-3"; } else { return; } if (size4 > 3) { go = GameObject.Instantiate(obj, CoordinateConversions.CubeToSquare(s44 [0], s44 [1], s44 [2]), Quaternion.identity) as GameObject; go.name = "4-4"; } else { return; } if (size4 > 4) { go = GameObject.Instantiate(obj, CoordinateConversions.CubeToSquare(s45 [0], s45 [1], s45 [2]), Quaternion.identity) as GameObject; go.name = "4-5"; } else { return; } if (size4 > 5) { go = GameObject.Instantiate(obj, CoordinateConversions.CubeToSquare(s46 [0], s46 [1], s46 [2]), Quaternion.identity) as GameObject; go.name = "4-6"; } else { return; } }
private void Generate3rd() { GameObject go; Object obj = SelectPrefab.SolidHex(colorList [2]); if (size3 > 0) { go = GameObject.Instantiate(obj, CoordinateConversions.CubeToSquare(s31 [0], s31 [1], s31 [2]), Quaternion.identity) as GameObject; go.name = "3-1"; } else { return; } if (size3 > 1) { go = GameObject.Instantiate(obj, CoordinateConversions.CubeToSquare(s32 [0], s32 [1], s32 [2]), Quaternion.identity) as GameObject; go.name = "3-2"; } else { return; } if (size3 > 2) { go = GameObject.Instantiate(obj, CoordinateConversions.CubeToSquare(s33 [0], s33 [1], s33 [2]), Quaternion.identity) as GameObject; go.name = "3-3"; } else { return; } if (size3 > 3) { go = GameObject.Instantiate(obj, CoordinateConversions.CubeToSquare(s34 [0], s34 [1], s34 [2]), Quaternion.identity) as GameObject; go.name = "3-4"; } else { return; } if (size3 > 4) { go = GameObject.Instantiate(obj, CoordinateConversions.CubeToSquare(s35 [0], s35 [1], s35 [2]), Quaternion.identity) as GameObject; go.name = "3-5"; } else { return; } if (size3 > 5) { go = GameObject.Instantiate(obj, CoordinateConversions.CubeToSquare(s36 [0], s36 [1], s36 [2]), Quaternion.identity) as GameObject; go.name = "3-6"; } else { return; } }
private void Generate2nd() { GameObject go; Object obj = SelectPrefab.SolidHex(colorList [1]); if (size2 > 0) { go = GameObject.Instantiate(obj, CoordinateConversions.CubeToSquare(s21 [0], s21 [1], s21 [2]), Quaternion.identity) as GameObject; go.name = "2-1"; } else { return; } if (size2 > 1) { go = GameObject.Instantiate(obj, CoordinateConversions.CubeToSquare(s22 [0], s22 [1], s22 [2]), Quaternion.identity) as GameObject; go.name = "2-2"; } else { return; } if (size2 > 2) { go = GameObject.Instantiate(obj, CoordinateConversions.CubeToSquare(s23 [0], s23 [1], s23 [2]), Quaternion.identity) as GameObject; go.name = "2-3"; } else { return; } if (size2 > 3) { go = GameObject.Instantiate(obj, CoordinateConversions.CubeToSquare(s24 [0], s24 [1], s24 [2]), Quaternion.identity) as GameObject; go.name = "2-4"; } else { return; } if (size2 > 4) { go = GameObject.Instantiate(obj, CoordinateConversions.CubeToSquare(s25 [0], s25 [1], s25 [2]), Quaternion.identity) as GameObject; go.name = "2-5"; } else { return; } if (size2 > 5) { go = GameObject.Instantiate(obj, CoordinateConversions.CubeToSquare(s26 [0], s26 [1], s26 [2]), Quaternion.identity) as GameObject; go.name = "2-6"; } else { return; } }
public void Spawn() { nextNum = Randomization.RandomPercentage(); // Debug.Log ("num: " + nextNum); // Debug.Log ("score: " + score); if (score == 0) { sc.AddShape(SelectPrefab.RandomShape(), 1); } if (score == 10) { if (nextNum < 20) { sc.AddShape(SelectPrefab.RandomShape(), 1); } } if (score > 100) { if (nextNum < 30) { sc.AddShape(SelectPrefab.RandomShape(), 1); } } if (score > 250) { if (nextNum < 40) { sc.AddShape(SelectPrefab.RandomShape(), 1); } } if (score > 300 && queues[1].activeSelf == false) { queues [1].SetActive(true); } if (score > 300) { if (nextNum < 25) { sc.AddShape(SelectPrefab.RandomShape(), 1); } if (nextNum < 25) { sc.AddShape(SelectPrefab.RandomShape(), 2); } } if (sc.ShapesQueued.Count == 0) { sc.AddShape(SelectPrefab.RandomShape(), 1); } }
// Update is called once per frame void Update() { if (Input.GetKeyUp(KeyCode.Space) && sc.Ready()) { lc.NextTurn(); } if (dragging && Input.GetKeyUp(KeyCode.Q)) { dragged.transform.Rotate(Vector3.forward, 60f); selected.transform.Rotate(Vector3.forward, 60f); } if (dragging && Input.GetKeyUp(KeyCode.E)) { dragged.transform.Rotate(Vector3.forward, -60f); selected.transform.Rotate(Vector3.forward, -60f); } if (Input.GetMouseButtonDown(0)) { lastPos = mousePos; } mousePos = Camera.main.ScreenToWorldPoint(new Vector2(Input.mousePosition.x, Input.mousePosition.y)); // Debug.Log ("last: " + lastPos + "cur: " + mousePos); if (Input.GetMouseButtonUp(0) && lastPos == mousePos && dragging) { // Debug.Log (5); if (LayerMask.NameToLayer("Map") == -1) { // Debug.Log ("problem"); } hit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero, Mathf.Infinity, LayerMask.GetMask("Map")); if (hit.collider != null && mc.CheckMapTile(hit.collider.gameObject.GetComponent <TileManager> ())) { // Debug.Log (6); sc.PlaceShape(selected.GetComponent <ShapeManager> ()); selected.transform.position = hit.collider.transform.position; GameObject.Destroy(dragged); dragging = false; return; } else if (hit.collider != null) { // Debug.Log (hit.collider.gameObject); } } if (Input.GetMouseButtonUp(0) && lastPos == mousePos && !dragging) { // Debug.Log (1); hit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero); if (hit.collider != null) { ShapeManager sm = hit.collider.gameObject.GetComponentInParent <Transform> ().GetComponentInParent <ShapeManager> (); if (sc.Enqueued(sm)) { // Debug.Log (2); dragging = true; selected = sm.gameObject; dragged = GameObject.Instantiate(SelectPrefab.PreviewHex(GetColorFromShapeID(sm.GetShape().ID)), new Vector3(), Quaternion.identity) as GameObject; // Debug.Log (selected); } } } if (dragging) { // Debug.Log (3); hit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero); if (hit.collider != null) { TileManager tm = hit.collider.gameObject.GetComponent <TileManager> (); if (mc.CheckMapTile(tm)) { // Debug.Log (4); if (Mathf.Abs(tm.MT.R) < Constants.mapRadius - 1 && Mathf.Abs(tm.MT.B) < Constants.mapRadius - 1 && Mathf.Abs(tm.MT.G) < Constants.mapRadius - 1) { dragged.transform.position = hit.collider.transform.position; } // if (Input.GetMouseButtonUp (0) && lastPos == mousePos){ // Debug.Log (5); // sc.PlaceShape (gameObject.GetComponent<ShapeManager> ()); // dragging = false; // } // else{ // if(Input.GetMouseButtonUp (0)){ // Debug.Log ((lastPos == mousePos) + " " + lastPos + " " + mousePos); // } // } } } } }