void Update() { if (center == null) { _defence.ClearPeaceNum(index); this.GetComponent <Image>().color = Color.white; } if (center != null) { difIndex = center.GetComponent <DefenceImage>().difIndex; difNum = center.GetComponent <DefenceImage>().difNum; if (difIndex != -1 && difNum != "-1") { if (!isCenter) { string[] pos = SetRotationPosNum(center, childpos.Split('.')).Split('.'); difIndex += int.Parse(pos[0]) - int.Parse(pos[1]) * _defence.width; if (!(difIndex < 0 || difIndex >= _defence.size)) { string[] difPos = difNum.Split('.'); difNum = (int.Parse(pos[0]) + int.Parse(difPos[0])).ToString() + "." + (-int.Parse(pos[1]) + int.Parse(difPos[1])).ToString(); } } _defence.SetPeaceNum(difIndex); try { GameObject.Find(difNum).GetComponent <Image>().color = center.color; } catch { } } } }