public triggerInfo(triggerInfo copy) { triPos = copy.triPos; edgeT = copy.edgeT; }
//重新計算此碎片的觸發邊 /*public void ThisReDetectEdge(Fragment theF) * { * theF.m_Data.triggerCount = 0; //中多少條邊就triggerCount++ * * //先觀察有哪些鄰居存在 * for (int i = 0; i < theF.m_Data.neighborRelativeInfo.Count; i++) //幾個邊 * { * bool AllOK = true; * for (int j = 0; j < theF.m_Data.neighborRelativeInfo[i].neighborRelative_id.Count; j++) //幾個點組成一個邊 * { * if (AllStar.Instance.stars[theF.m_Data.neighbors[theF.m_Data.neighborRelativeInfo[i].neighborRelative_id[j]].starID].fragID == -1) * { * AllOK = false; * break; * } * } * if (AllOK) * { * theF.m_Data.triggerCount++; * } * } * }*/ //____________________________________________________________________________________________________________________________________________ //檢查哪些Affix可以用 public void ThisReDetectAffix(Fragment theF) { theF.m_Data.triggerCount = 0; //中多少條邊就triggerCount++ //先觀察有哪些鄰居存在 for (int i = 0; i < theF.m_Data.neighborRelativeInfo.Count; i++) //幾個邊 { bool AllOK = true; for (int j = 0; j < theF.m_Data.neighborRelativeInfo[i].relativeInfo.Count; j++) //幾個點組成一個邊 { triggerInfo t = theF.m_Data.neighborRelativeInfo[i].relativeInfo[j]; Vector2 temp; switch (t.edgeT) { case edgeTrigger.: temp = new Vector2(theF.m_Data.centerAbsPos.x + t.triPos.x, theF.m_Data.centerAbsPos.y + t.triPos.y + 1); break; case edgeTrigger.: temp = new Vector2(theF.m_Data.centerAbsPos.x + t.triPos.x, theF.m_Data.centerAbsPos.y + t.triPos.y - 1); break; case edgeTrigger.右: temp = new Vector2(theF.m_Data.centerAbsPos.x + t.triPos.x + 1, theF.m_Data.centerAbsPos.y + t.triPos.y); break; default: //case edgeTrigger.左: temp = new Vector2(theF.m_Data.centerAbsPos.x + t.triPos.x - 1, theF.m_Data.centerAbsPos.y + t.triPos.y); break; } int sId = AllStar.Instance.stars.FindIndex(x => x.pos == temp); if (sId == -1) { AllOK = false; break; } if (AllStar.Instance.stars[sId].fragID == -1) { AllOK = false; break; } } if (AllOK) { theF.m_Data.triggerCount++; //Debug.Log(theF.m_Data.fragmentID + theF.name+ " 's Affix : " + theF.m_Data.neighborRelativeInfo[i].theAffix.description); theF.m_Data.neighborRelativeInfo[i].check = true; //邊亮起來 //theF.m_Data.neighborRelativeInfo[i].relativeInfo[1]. //ing //若要單一 一次對一個Affix觸發 則要在這做 } else { theF.m_Data.neighborRelativeInfo[i].check = false; } } }