public void ChangeSigelState()//碰到物件服文變換 { if (SceneManager.GetActiveScene().name == "m1") { Sigel1.SetActive(false); Exit1Obj.GetComponent <ChangeMap>().enabled = false; Exit1Obj.GetComponent <BoxCollider2D>().isTrigger = true; Sigel2.SetActive(true); Exit2Obj.GetComponent <ChangeMap>().enabled = true; Exit2Obj.GetComponent <BoxCollider2D>().isTrigger = false; for (int i = 0; i < SigelList.Count; i++) { SigelList[i] = RotateSigel(SigelList[i], Exit2); } } }
public void SetToBadEnd() { Exit1Obj.GetComponent <ChangeMap>()._uiTitle = UiTitle.GoodEnd; }
void Map(string mapStr) { var l = GetNextChars(mapStr, 1); List <int> i = new List <int>(); foreach (var item in l) { i.Add(int.Parse(item)); } int count = 0; mapHolder = new GameObject("Map").transform;//0=null,1 =詩人, 2=王蟲,3=樹,4=水晶,5=玩家,6=怪物,7=陷阱(出口符雯1),8=出口2符文 for (float x = cols; x > 0; x--) { for (int y = 0; y < rows; y++) { GameObject go; mapUnits.Add(new MapUnit(i[count], new Vector2(y, x))); switch (i[count]) { case 0: FloorList.Add(new MapUnit(i[count], new Vector2(y, x))); break; case 1: go = Instantiate(ObjArray[1], new Vector3(y, x, -1), Quaternion.identity) as GameObject; go.transform.SetParent(mapHolder); houseList.Add(new MapUnit(1, new Vector2(y, x))); break; case 2: go = Instantiate(ObjArray[2], new Vector3(y, x, -2), Quaternion.identity) as GameObject; go.transform.SetParent(mapHolder); EndhouseList.Add(new MapUnit(i[count], new Vector2(y, x), go)); if (SceneManager.GetActiveScene().name.ToLower() == "m2" || SceneManager.GetActiveScene().name.ToLower() == "m3") { Exit1Obj = go; //gameData._uiTitle = UiTitle.GoodEnd; Exit1Obj.AddComponent <ChangeMap>().MapStr = "end"; Exit1Obj.GetComponent <ChangeMap>()._uiTitle = UiTitle.GoodEnd; Exit1 = new Vector2(y, x); GameObject go2 = Instantiate(ObjArray[7], new Vector3(y, x - 0.3f, -3), Quaternion.identity) as GameObject; go2.transform.SetParent(mapHolder); Sigel1 = go2; } if (SceneManager.GetActiveScene().name.ToLower() == "m1") { EndhouseList.Add(new MapUnit(2, new Vector2(y, x), go)); } break; case 3: go = Instantiate(ObjArray[i[count]], new Vector3(y, x, -1), Quaternion.identity) as GameObject; go.transform.SetParent(mapHolder); break; case 4: go = Instantiate(ObjArray[i[count]], new Vector3(y, x, -1), Quaternion.identity) as GameObject; go.transform.SetParent(mapHolder); LamplList.Add(go); //把水晶存起來 break; case 5: go = Instantiate(ObjArray[i[count]], new Vector3(y, x, 0), Quaternion.identity) as GameObject; go.transform.SetParent(mapHolder); break; case 6: go = Instantiate(MonsterArray[Random.Range(0, MonsterArray.Length)], new Vector3(y, x, -1), Quaternion.identity) as GameObject; go.transform.SetParent(mapHolder); MonsterList.Add(go); break; case 7: go = Instantiate(TrapArray[Random.Range(0, TrapArray.Length)], new Vector3(y, x, -1), Quaternion.identity) as GameObject; go.transform.SetParent(mapHolder); break; default: Debug.Log(""); break; } go = Instantiate(FloorArray[0], new Vector3(y, x, 0), Quaternion.identity) as GameObject; go.transform.SetParent(mapHolder); count++; } } CreatExit_ExExit(); foreach (var house in houseList) { if (Random.Range(0, 10) < 8)//30%創建符文 { CreatSigel(house.vector2); } } }