Advertisement
Guest User

Untitled

a guest
Jul 18th, 2015
320
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 18.28 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.IO;
  7. using UnityEngine;
  8.  
  9. namespace meta {
  10.     //I got some inspiration for this class from ITR, so most of the credit for this part of the code goes to ITR, thanks!
  11.     //http://www.forum.spiderlinggames.co.uk/forum/main-forum/besiege-early-access/modding/17686-more-colors-mod-spaar-s-modloader
  12.     public class Tint : MonoBehaviour {
  13.         public Tint() {
  14.  
  15.         }
  16.  
  17.         public Color[] originalColors;
  18.  
  19.         public Color currentColor;
  20.  
  21.         public void BackToOriginal() {
  22.             if(originalColors==null) {
  23.                 TintIt(Color.white);
  24.                 return;
  25.             }
  26.  
  27.             int ccc = 0;
  28.            
  29.             MeshRenderer[] componentsInChildren = base.GetComponentsInChildren<MeshRenderer>();
  30.             for(int i = 0;i < componentsInChildren.Length;i++) {
  31.                 Material[] materials = componentsInChildren[i].materials;
  32.                 for(int j = 0;j < materials.Length;j++) {
  33.                     Material material = materials[j];
  34.                     if(material.HasProperty("_Color")) {
  35.                         if(ccc<originalColors.Length) {
  36.                             material.color = originalColors[ccc];
  37.                             currentColor = originalColors[ccc];
  38.                             ccc++;
  39.                         }
  40.                         else {
  41.                             material.color = Color.white;
  42.                             currentColor = Color.white;
  43.                         }
  44.                     }
  45.                 }
  46.             }
  47.         }
  48.  
  49.         public void TintIt(Color color) {
  50.             List<Color> colors = new List<Color>();
  51.             MeshRenderer[] componentsInChildren = base.GetComponentsInChildren<MeshRenderer>();
  52.             for(int i = 0;i < componentsInChildren.Length;i++) {
  53.                 Material[] materials = componentsInChildren[i].materials;
  54.                 for(int j = 0;j < materials.Length;j++) {
  55.                     Material material = materials[j];
  56.                     if(material.HasProperty("_Color")) {
  57.                         colors.Add(material.color);
  58.                         material.color = color;
  59.                         currentColor = color;
  60.                     }
  61.                 }
  62.             }
  63.             if(originalColors==null&&colors.Count!=0)
  64.                 originalColors = colors.ToArray();
  65.         }
  66.     }
  67.  
  68.     [spaar.Mod("BesiegeSelectionMoverMod",author="TesseractCat",version="1.3")]
  69.     public class BesiegeSelectionMoverMod : MonoBehaviour {
  70.  
  71.  
  72.         Vector3 hugeSelectPos1 = Vector3.zero;
  73.         Vector3 hugeSelectPos2 = Vector3.zero;
  74.  
  75.         public void Start() {
  76.             spaar.Commands.RegisterHelpMessage("BesiegeSelctionHoverMod commands:\n POS1 check/[x] /[y] /[z]\n  POS2 check/[x] /[y] /[z]\n  SELECT /{blocktypelist}");
  77.  
  78.             spaar.Commands.RegisterCommand("POS1",(args,namedArgs) => {
  79.                 if(args.Length<1) {
  80.                     hugeSelectPos1 = Camera.main.transform.position;
  81.                     return "Set position to "+hugeSelectPos1.ToString();
  82.                 }
  83.                 if(args[0].ToLower()=="here") {
  84.                     hugeSelectPos1 = Camera.main.transform.position;
  85.                     return "Set position to "+hugeSelectPos1.ToString();
  86.                 }
  87.                 else if(args[0].ToLower()=="check") {
  88.                     return "POS1: "+hugeSelectPos1.ToString();
  89.                 }
  90.                 else if(args.Length<3) {
  91.                     return "Missing arguments";
  92.                 }
  93.                 float a,b,c;
  94.                 try {
  95.                     a = float.Parse(args[0]);
  96.                 }
  97.                 catch {
  98.                     return "Failed to parse argument 1";
  99.                 }
  100.                 try {
  101.                     b = float.Parse(args[1]);
  102.                 }
  103.                 catch {
  104.                     return "Failed to parse argument 2";
  105.                 }
  106.                 try {
  107.                     c = float.Parse(args[2]);
  108.                 }
  109.                 catch {
  110.                     return "Failed to parse argument 3";
  111.                 }
  112.                 hugeSelectPos1 = new Vector3(a,b,c);
  113.                 return "Set position to "+hugeSelectPos1.ToString();
  114.             },"Sets the hugeselection pos1 to the camera position or inputted coordinates");
  115.  
  116.             spaar.Commands.RegisterCommand("POS2",(args,namedArgs) => {
  117.                 if(args.Length<1) {
  118.                     hugeSelectPos1 = Camera.main.transform.position;
  119.                     return "Set position to "+hugeSelectPos1.ToString();
  120.                 }
  121.                 if(args[0].ToLower()=="here") {
  122.                     hugeSelectPos2 = Camera.main.transform.position;
  123.                     return "Set position to "+hugeSelectPos2.ToString();
  124.                 }
  125.                 else if(args[0].ToLower()=="check") {
  126.                     return "POS2: "+hugeSelectPos2.ToString();
  127.                 }
  128.                 else if(args.Length<3) {
  129.                     return "Missing arguments";
  130.                 }
  131.                 float a,b,c;
  132.                 try {
  133.                     a = float.Parse(args[0]);
  134.                 }
  135.                 catch {
  136.                     return "Failed to parse argument 1";
  137.                 }
  138.                 try {
  139.                     b = float.Parse(args[1]);
  140.                 }
  141.                 catch {
  142.                     return "Failed to parse argument 2";
  143.                 }
  144.                 try {
  145.                     c = float.Parse(args[2]);
  146.                 }
  147.                 catch {
  148.                     return "Failed to parse argument 3";
  149.                 }
  150.                 hugeSelectPos2 = new Vector3(a,b,c);
  151.                 return "Set position to "+hugeSelectPos2.ToString();
  152.             },"Sets the hugeselection pos2 to the camera position or inputted coordinates");
  153.  
  154.             spaar.Commands.RegisterCommand("SELECT",(args,namedArgs) => {
  155.  
  156.                 if(!namedArgs.ContainsKey("keep")) {
  157.                     namedArgs["keep"] = "false";
  158.                 }
  159.                 if(!namedArgs.ContainsKey("deselect")) {
  160.                     namedArgs["deselect"] = "false";
  161.                 }
  162.                 MyBlockInfo[] myBlockInfos = FindObjectsOfType<MyBlockInfo>();
  163.                 if(namedArgs["deselect"].ToLower() == "false") {
  164.                     for(int i = 0;i<myBlockInfos.Length;i++) {
  165.                         if(myBlockInfos[i].GetComponent<Tint>()==null) {
  166.                             bool valid = true;
  167.                             if(namedArgs["keep"]=="false") {
  168.                                 foreach(string blockname in args) {
  169.                                     if(myBlockInfos[i].blockName==blockname) {
  170.                                         valid = false;
  171.                                         break;
  172.                                     }
  173.                                 }
  174.                             }
  175.                             else {
  176.                                 valid = false;
  177.                                 foreach(string blockname in args) {
  178.                                     if(myBlockInfos[i].blockName==blockname) {
  179.                                         valid = true;
  180.                                         break;
  181.                                     }
  182.                                 }
  183.                             }
  184.                             if(!valid)
  185.                                 continue;
  186.  
  187.                             if(hugeSelectPos1.x<=hugeSelectPos2.x) {
  188.                                 if(myBlockInfos[i].transform.position.x<hugeSelectPos1.x||myBlockInfos[i].transform.position.x>hugeSelectPos2.x) {
  189.                                     continue;
  190.                                 }
  191.                             }
  192.                             else {
  193.                                 if(myBlockInfos[i].transform.position.x>hugeSelectPos1.x||myBlockInfos[i].transform.position.x<hugeSelectPos2.x) {
  194.                                     continue;
  195.                                 }
  196.                             }
  197.  
  198.                             if(hugeSelectPos1.y<=hugeSelectPos2.y) {
  199.                                 if(myBlockInfos[i].transform.position.y<hugeSelectPos1.y||myBlockInfos[i].transform.position.y>hugeSelectPos2.y) {
  200.                                     continue;
  201.                                 }
  202.                             }
  203.                             else {
  204.                                 if(myBlockInfos[i].transform.position.y>hugeSelectPos1.y||myBlockInfos[i].transform.position.y<hugeSelectPos2.y) {
  205.                                     continue;
  206.                                 }
  207.                             }
  208.  
  209.                             if(hugeSelectPos1.z<=hugeSelectPos2.z) {
  210.                                 if(myBlockInfos[i].transform.position.z<hugeSelectPos1.z||myBlockInfos[i].transform.position.z>hugeSelectPos2.z) {
  211.                                     continue;
  212.                                 }
  213.                             }
  214.                             else {
  215.                                 if(myBlockInfos[i].transform.position.z>hugeSelectPos1.z||myBlockInfos[i].transform.position.z<hugeSelectPos2.z) {
  216.                                     continue;
  217.                                 }
  218.                             }
  219.                             myBlockInfos[i].gameObject.AddComponent<Tint>().TintIt(Color.green);
  220.                         }
  221.                     }
  222.                 }
  223.                 else {
  224.                     for(int i = 0;i<myBlockInfos.Length;i++) {
  225.                         if(myBlockInfos[i].GetComponent<Tint>()!=null) {
  226.                             bool valid = true;
  227.                             if(namedArgs["keep"]=="false") {
  228.                                 foreach(string blockname in args) {
  229.                                     if(myBlockInfos[i].blockName==blockname) {
  230.                                         valid = false;
  231.                                         break;
  232.                                     }
  233.                                 }
  234.                             }
  235.                             else {
  236.                                 valid = false;
  237.                                 foreach(string blockname in args) {
  238.                                     if(myBlockInfos[i].blockName==blockname) {
  239.                                         valid = true;
  240.                                         break;
  241.                                     }
  242.                                 }
  243.                             }
  244.                             if(!valid)
  245.                                 continue;
  246.  
  247.                             if(hugeSelectPos1.x<=hugeSelectPos2.x) {
  248.                                 if(myBlockInfos[i].transform.position.x<hugeSelectPos1.x||myBlockInfos[i].transform.position.x>hugeSelectPos2.x) {
  249.                                     continue;
  250.                                 }
  251.                             }
  252.                             else {
  253.                                 if(myBlockInfos[i].transform.position.x>hugeSelectPos1.x||myBlockInfos[i].transform.position.x<hugeSelectPos2.x) {
  254.                                     continue;
  255.                                 }
  256.                             }
  257.  
  258.                             if(hugeSelectPos1.y<=hugeSelectPos2.y) {
  259.                                 if(myBlockInfos[i].transform.position.y<hugeSelectPos1.y||myBlockInfos[i].transform.position.y>hugeSelectPos2.y) {
  260.                                     continue;
  261.                                 }
  262.                             }
  263.                             else {
  264.                                 if(myBlockInfos[i].transform.position.y>hugeSelectPos1.y||myBlockInfos[i].transform.position.y<hugeSelectPos2.y) {
  265.                                     continue;
  266.                                 }
  267.                             }
  268.  
  269.                             if(hugeSelectPos1.z<=hugeSelectPos2.z) {
  270.                                 if(myBlockInfos[i].transform.position.z<hugeSelectPos1.z||myBlockInfos[i].transform.position.z>hugeSelectPos2.z) {
  271.                                     continue;
  272.                                 }
  273.                             }
  274.                             else {
  275.                                 if(myBlockInfos[i].transform.position.z>hugeSelectPos1.z||myBlockInfos[i].transform.position.z<hugeSelectPos2.z) {
  276.                                     continue;
  277.                                 }
  278.                             }
  279.                             Tint tint = myBlockInfos[i].gameObject.GetComponent<Tint>();
  280.                             tint.BackToOriginal();
  281.                             Destroy(tint);
  282.                         }
  283.                     }
  284.                 }
  285.  
  286.                 return "";
  287.             },"Selects all blocks between hugeselection pos1 and hugeselection pos2, write all blocks you want to exclude from the copy after \"SELECT\", use \"--keep true\" if you want to *only* use those blocks instead, and \"--deselect true\" if you want to deselect");
  288.         }
  289.  
  290.  
  291.         public Rect windowRect = new Rect(20,20,250,150);
  292.         public float Step = 1f;
  293.         public string ModifierKey = "q";
  294.  
  295.         void OnGUI() {
  296.             if(GameObject.Find("ArrowsCenter")) {
  297.                 windowRect = GUI.Window(-1,windowRect,DoMyWindow,"Selection Move Config");
  298.             }
  299.         }
  300.  
  301.  
  302.  
  303.         void DoMyWindow(int windowID) {
  304.  
  305.             GUILayout.BeginVertical("Box");
  306.  
  307.             GUILayout.BeginHorizontal();
  308.  
  309.             GUILayout.Label("Step:");
  310.  
  311.             Step = GUILayout.HorizontalSlider(Step,0,1);
  312.             GUILayout.EndHorizontal();
  313.  
  314.             string lengthText = GUILayout.TextField(Step.ToString("0.00"));
  315.  
  316.             float newLength;
  317.             if(float.TryParse(lengthText,out newLength)) {
  318.                 Step = newLength;
  319.             }
  320.             GUILayout.EndVertical();
  321.  
  322.             GUILayout.BeginVertical("Box");
  323.  
  324.             GUILayout.BeginHorizontal();
  325.             GUILayout.Label("Select = Ctrl + ");
  326.             ModifierKey = GUILayout.TextField(ModifierKey,1);
  327.             GUILayout.EndHorizontal();
  328.  
  329.             GUILayout.Label("Click = Ctrl");
  330.  
  331.             GUILayout.EndVertical();
  332.  
  333.             GUI.DragWindow();
  334.         }
  335.  
  336.         public GameObject Center;
  337.         public GameObject Left;
  338.         public GameObject Right;
  339.         public GameObject Forward;
  340.         public GameObject Backward;
  341.         public GameObject Up;
  342.         public GameObject Down;
  343.  
  344.         void MakeBlock(string name,Vector3 pos,Quaternion rot) {
  345.             Debug.Log("Test1");
  346.             //GameObject.Find ("BUILDER").GetComponent<AddPiece> ().cu
  347.             //AddPiece.currentBlockType = 2;
  348.             //GameObject.Find ("BUILDER").GetComponent<AddPiece> ().AddBlock (pos, rot);
  349.             //GameObject.Find ("BUILDER").GetComponent<AddPiece> ().AddBlockType();
  350.             //GameObject.Find ("BUILDER").GetComponent<AddPiece> ()
  351.             Debug.Log("Test2");
  352.         }
  353.  
  354.         public void Update() {
  355.             if(AddPiece.isSimulating && GameObject.Find("ArrowsCenter")) {
  356.                 Destroy(Center);
  357.                 Destroy(Up);
  358.                 Destroy(Down);
  359.                 /**foreach (MyBlockInfo Block in GameObject.FindObjectsOfType<MyBlockInfo>() as MyBlockInfo[]) {
  360.                         try {
  361.                                 Block.GetComponent<Tint> ().TintIt (Color.white);
  362.                                 Destroy(Block.GetComponent<Tint> ());
  363.                         } catch {
  364.  
  365.                         }
  366.                 }**/
  367.             }
  368.             else {
  369.  
  370.             }
  371.  
  372.             if(GameObject.Find("bgeL0")!=null&&AddPiece.isSimulating!=true) {
  373.                 if(Input.GetKey(KeyCode.LeftControl) && Input.GetKeyDown(ModifierKey) || Input.GetKey(KeyCode.RightControl) && Input.GetKeyDown(ModifierKey)) {
  374.                     RaycastHit hit;
  375.                     Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
  376.  
  377.                     if(Physics.Raycast(ray,out hit)) {
  378.                         Transform objectHit = hit.transform;
  379.  
  380.                         if(objectHit.GetComponent<MyBlockInfo>()!=null) {
  381.                             if(objectHit.GetComponent<Tint>() == null) {
  382.                                 objectHit.gameObject.AddComponent<Tint>();
  383.                                 objectHit.GetComponent<Tint>().TintIt(Color.green);
  384.                             }
  385.                             else {
  386.                                 objectHit.GetComponent<Tint>().BackToOriginal();
  387.                                 Destroy(objectHit.GetComponent<Tint>());
  388.                             }
  389.                         }
  390.                     }
  391.                 }
  392.  
  393.                 MyBlockInfo[] Blocks = FindObjectsOfType<MyBlockInfo>() as MyBlockInfo[];
  394.                 List<Transform> SelectedBlocks = new List<Transform>();
  395.  
  396.                 foreach(MyBlockInfo Block in Blocks) {
  397.                     if(Block.GetComponent<Tint>() != null && Block.GetComponent<Tint>().currentColor != Color.white) {
  398.                         SelectedBlocks.Add(Block.transform);
  399.                         Block.GetComponent<Tint>().TintIt(Color.green);
  400.                     }
  401.                     else if(Block.GetComponent<Tint>() != null && Block.GetComponent<Tint>().currentColor == Color.white) {
  402.                         Destroy(Block.GetComponent<Tint>());
  403.                     }
  404.                 }
  405.  
  406.                 if(Input.GetKey(KeyCode.LeftControl) && Input.GetKeyDown(KeyCode.C) || Input.GetKey(KeyCode.RightControl) && Input.GetKeyDown(KeyCode.C)) {
  407.                     //GameObject.Find("BUILDER").GetComponent<AddPiece>().AddBlockAtPosNoSave(0,new Vector3(0,1,0),new Quaternion());
  408.  
  409.                     for(int i=0;i<SelectedBlocks.Count;i++) {
  410.                         Transform tempBlock = (Transform)Instantiate(SelectedBlocks[i]);
  411.                         tempBlock.position = SelectedBlocks[i].position;
  412.                         tempBlock.GetComponent<Tint>().TintIt(Color.green);
  413.                         tempBlock.transform.parent = GameObject.Find("BUILDER").GetComponent<AddPiece>().machineParent;
  414.                         SelectedBlocks[i].GetComponent<Tint>().BackToOriginal();
  415.                         //tempBlock.name = "bsg" + (Max+1).ToString ();
  416.                         //Max++;
  417.  
  418.                         //MakeBlock (SelectedBlocks[i].GetComponent<MyBlockInfo>().blockName,new Vector3(SelectedBlocks[i].position.x,SelectedBlocks[i].position.y,SelectedBlocks[i].position.z),SelectedBlocks[i].rotation);
  419.  
  420.                         //GameObject tempBlock = new GameObject ();
  421.                         //tempBlock.AddComponent<AddPiece> ();
  422.  
  423.                         //global::AddPiece.AddBlockAtPosNoSave (0,
  424.                         //      new Vector3(Block.position.x,Block.position.y+1,Block.position.z),
  425.                         //      new Quaternion(Block.rotation.x,Block.rotation.y,Block.rotation.z,Block.rotation.w));
  426.                     }
  427.                 }
  428.  
  429.                 if(SelectedBlocks.Count > 0) {
  430.                     if(GameObject.Find("ArrowsCenter") == null) {
  431.                         Center = GameObject.CreatePrimitive(PrimitiveType.Sphere);
  432.                         Center.name = "ArrowsCenter";
  433.                         Center.transform.position = GameObject.Find("bgeL0").transform.position;
  434.                         Center.layer = 23;
  435.                         Center.collider.isTrigger = true;
  436.  
  437.                         Up = GameObject.CreatePrimitive(PrimitiveType.Sphere);
  438.                         Up.transform.position = new Vector3(GameObject.Find("bgeL0").transform.position.x,GameObject.Find("bgeL0").transform.position.y+1.5f,GameObject.Find("bgeL0").transform.position.z);
  439.                         Up.name = "ArrowsUp";
  440.                         Up.layer = 23;
  441.                         Up.transform.parent = Center.transform;
  442.                         Up.collider.isTrigger = true;
  443.  
  444.                         Down = GameObject.CreatePrimitive(PrimitiveType.Sphere);
  445.                         Down.transform.position = new Vector3(GameObject.Find("bgeL0").transform.position.x,GameObject.Find("bgeL0").transform.position.y-1.5f,GameObject.Find("bgeL0").transform.position.z);
  446.                         Down.name = "ArrowsDown";
  447.                         Down.layer = 23;
  448.                         Down.transform.parent = Center.transform;
  449.                         Down.collider.isTrigger = true;
  450.  
  451.                         Forward = GameObject.CreatePrimitive(PrimitiveType.Sphere);
  452.                         Forward.transform.position = new Vector3(GameObject.Find("bgeL0").transform.position.x+1.5f,GameObject.Find("bgeL0").transform.position.y,GameObject.Find("bgeL0").transform.position.z);
  453.                         Forward.name = "ArrowsForward";
  454.                         Forward.layer = 23;
  455.                         Forward.transform.parent = Center.transform;
  456.                         Forward.collider.isTrigger = true;
  457.  
  458.                         Backward = GameObject.CreatePrimitive(PrimitiveType.Sphere);
  459.                         Backward.transform.position = new Vector3(GameObject.Find("bgeL0").transform.position.x-1.5f,GameObject.Find("bgeL0").transform.position.y,GameObject.Find("bgeL0").transform.position.z);
  460.                         Backward.name = "ArrowsBackward";
  461.                         Backward.layer = 23;
  462.                         Backward.transform.parent = Center.transform;
  463.                         Backward.collider.isTrigger = true;
  464.  
  465.                         Left = GameObject.CreatePrimitive(PrimitiveType.Sphere);
  466.                         Left.transform.position = new Vector3(GameObject.Find("bgeL0").transform.position.x,GameObject.Find("bgeL0").transform.position.y,GameObject.Find("bgeL0").transform.position.z+1.5f);
  467.                         Left.name = "ArrowsLeft";
  468.                         Left.layer = 23;
  469.                         Left.transform.parent = Center.transform;
  470.                         Left.collider.isTrigger = true;
  471.  
  472.                         Right = GameObject.CreatePrimitive(PrimitiveType.Sphere);
  473.                         Right.transform.position = new Vector3(GameObject.Find("bgeL0").transform.position.x,GameObject.Find("bgeL0").transform.position.y,GameObject.Find("bgeL0").transform.position.z-1.5f);
  474.                         Right.name = "ArrowsRight";
  475.                         Right.layer = 23;
  476.                         Right.transform.parent = Center.transform;
  477.                         Right.collider.isTrigger = true;
  478.                     }
  479.                     GameObject.Find("ArrowsCenter").transform.position = SelectedBlocks[0].transform.position;
  480.                 }
  481.                 else {
  482.                     Destroy(Center);
  483.                     Destroy(Up);
  484.                     Destroy(Down);
  485.                 }
  486.  
  487.                 if(Input.GetKeyDown(KeyCode.LeftControl) || Input.GetKeyDown(KeyCode.RightControl)) {
  488.                     RaycastHit hit;
  489.                     Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
  490.                     int layerMask = (1 << 23);
  491.  
  492.                     if(Physics.Raycast(ray,out hit,Mathf.Infinity,layerMask)) {
  493.                         Transform objectHit = hit.transform;
  494.  
  495.                         //Debug.Log ("The raycast has hit " + hit.transform.gameObject.name + ", layer is " + hit.transform.gameObject.layer);
  496.  
  497.                         if(objectHit.name == "ArrowsUp") {
  498.                             foreach(Transform Block in SelectedBlocks) {
  499.                                 Block.position = new Vector3(Block.position.x,Block.position.y + Step,Block.position.z);
  500.                             }
  501.                         }
  502.  
  503.                         if(objectHit.name == "ArrowsDown") {
  504.                             foreach(Transform Block in SelectedBlocks) {
  505.                                 Block.position = new Vector3(Block.position.x,Block.position.y - Step,Block.position.z);
  506.                             }
  507.                         }
  508.  
  509.                         if(objectHit.name == "ArrowsForward") {
  510.                             foreach(Transform Block in SelectedBlocks) {
  511.                                 Block.position = new Vector3(Block.position.x+Step,Block.position.y,Block.position.z);
  512.                             }
  513.                         }
  514.  
  515.                         if(objectHit.name == "ArrowsBackward") {
  516.                             foreach(Transform Block in SelectedBlocks) {
  517.                                 Block.position = new Vector3(Block.position.x-Step,Block.position.y,Block.position.z);
  518.                             }
  519.                         }
  520.  
  521.                         if(objectHit.name == "ArrowsRight") {
  522.                             foreach(Transform Block in SelectedBlocks) {
  523.                                 Block.position = new Vector3(Block.position.x,Block.position.y,Block.position.z-Step);
  524.                             }
  525.                         }
  526.  
  527.                         if(objectHit.name == "ArrowsLeft") {
  528.                             foreach(Transform Block in SelectedBlocks) {
  529.                                 Block.position = new Vector3(Block.position.x,Block.position.y,Block.position.z+Step);
  530.                             }
  531.                         }
  532.  
  533.  
  534.                         if(objectHit.name == "ArrowsCenter") {
  535.                             foreach(Transform Block in SelectedBlocks) {
  536.                                 Block.GetComponent<Tint>().BackToOriginal();
  537.                                 Destroy(Block.GetComponent<Tint>());
  538.                             }
  539.                         }
  540.                     }
  541.                 }
  542.             }
  543.         }
  544.     }
  545. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement