public void AddLoadList(List<mapClass> mapLoaded) { Debug.Log ("heard from loading!"); foreach (mapClass m in mapLoaded){ mapClass newMapObject = new mapClass(m.objName, m.index, m.objLoc); currentMap.Add (newMapObject); currentVector.Add (m.objLoc); } }
public void SavePosition() { float X = frame.transform.position.x; float minX = X - 600; float maxX = X + 600; List<mapClass> wholeMapList = new List<mapClass>(); int levelVersion = PlayerPrefs.GetInt("currentVersion"); if (levelVersion == 2 || levelVersion == 0){ wholeMapList = mainCamera.GetComponent<editorControl>().currentMap; }else if (levelVersion == 1 || levelVersion == 3){ wholeMapList = mainCamera.GetComponent<editorControlBuildOnly>().currentMap; } //Debug.Log (wholeMapList.Count); foreach(mapClass block in wholeMapList){ //Debug.Log(block.objLoc.x + "vs" + minX + "and" + maxX); if (block.objLoc.x >= minX && block.objLoc.x <= maxX){ /*JPATT EDIT START */ mapClass copiedWholeMapBlock = new mapClass(block.objName, block.index, block.objLoc); //Creating a new mapclass object so we're not directly referencing the old one copyMap.Add(copiedWholeMapBlock); /*JPATT EDIT END */ //Debug.Log ("save position of blocks counts: " + copyMap.Count); } } //Debug.Log (copyMap.Count); }
public void PasteCopyList(List<mapClass> pasteMap) { foreach(mapClass block in pasteMap){ if( !currentVector.Contains(block.objLoc)){ if ( block.objName == "PhaseChangeLine"){ } else { chosenBlock = (GameObject)Resources.Load(block.objName, typeof (GameObject)); pointCost = chosenBlock.GetComponent<BlockAttribute>().buildCost; if(curPoint >= 392 && pointCost < 0){ } else { GameObject newItem = Instantiate (chosenBlock, block.objLoc,chosenBlock.transform.rotation) as GameObject; newItem.name = block.objName + objIndex; mapClass newMapObject = new mapClass(block.objName, objIndex, block.objLoc); currentMap.Add (newMapObject); newItem.transform.parent = terrainBlock; currentVector.Add (block.objLoc); objIndex = objIndex+1; curPoint = curPoint - pointCost; } } } } }