private bool IsAllValid() { for (int j = 0; j < fires.Length; ++j) { if (fires[j].activeSelf) { continue; } else { return(false); } } for (int i = 0; i < 6; ++i) { LabObject child = transform.GetChild(i).GetComponent <LabObject>(); bool isValid = child.IsPosValid; if (child.ID == 15) { continue; } else { if (!child.IsPosValid) { return(false); } } } return(true); }
public virtual void Copy(LabObject info) { this.ID = info.ID; this.LabObjectType = info.LabObjectType; this.ObjType = info.ObjType; this.Position.Copy(info.Position); }
public override void ResumeInfo(LabObject Info) { base.ResumeInfo(Info); if (Info != null) { SetLinkInfo(Info as CircuitObject); } }
private void LeftGrabHandler(object sender, ObjectInteractEventArgs e) { LabObject labObject = e.target.GetComponent <LabObject>(); if (labObject != null && labObject.ID == ID) { ReleaseValidChildrenWhenGrab(); } }
private void LeftGrabRealseHandler(object sender, ObjectInteractEventArgs e) { if (e.target != null) { LabObject labObject = e.target.GetComponent <LabObject>(); if (labObject != null && labObject.ID == ID) { SetToValidPos(); StartCoroutine(AttachValidChildrenWhenUnGrab()); } } }
private void ReleaseValidChildrenWhenGrab() { Transform[] childrenTrans = _labObjectModule.GetChildrenTransform(ID); if (childrenTrans != null) { for (int i = 0; i < childrenTrans.Length; ++i) { LabObject labObj = childrenTrans[i].GetComponent <LabObject>(); if (!labObj.IsPosValid) { childrenTrans[i].SetParent(null); } } } }
public override void Copy(LabObject info) { base.Copy(info); if (info is CircuitObject) { CircuitObject cirObj = info as CircuitObject; this.CircuitInfo = cirObj.CircuitInfo; this.CtrlNode.Clear(); this.CtrlNode.AddRange(cirObj.CtrlNode); this.CtrlNode.Clear(); this.CtrlNode.AddRange(cirObj.CtrlNode); } }
private void JudgeIsPosValid() { if (ID == 15) { _isPosValid = true; return; } Transform[] childrenTrans = _labObjectModule.GetChildrenTransform(ID); float dis = Vector3.Distance(transform.localPosition, _labObjectModule.GetJsonLabObj(ID).JsonLocalTransform.JsonLocalPos.ToVector3()); if (_jsonLabObj.ParentID != -1 && dis > 0.01f) { _isPosValid = false; return; } else { if (childrenTrans != null) { for (int i = 0; i < childrenTrans.Length; ++i) { LabObject labObj = childrenTrans[i].GetComponent <LabObject>(); if (labObj.IsPosValid) { continue; } else { _isPosValid = false; return; } } _isPosValid = true; return; } else { _isPosValid = true; return; } } }
public override void ResumeInfo(LabObject Info) { base.ResumeInfo(Info); }
public void SetLabObject(int x, int y, LabObject type, string blocks) { if (blocks.Length != 16) { Debug.Log(Time.time + " : wrong length of parametr, must be equal 16."); } labTransforms[x, y] = (Transform)Instantiate(prefabs[(int)type], new Vector3(y * 2.0f + 3.0f, 0.0f, 28.0f - x * 2.0f), Quaternion.identity); labTransforms[x, y].parent = labParent; Bricks bricks = labTransforms[x, y].GetComponent<Bricks>(); bricks.x = x; bricks.y = y; SetBlockState(x, y, blocks); }
/// <summary> /// 撤销重做 /// </summary> /// <param name="timeStr"></param> /// <param name="info"></param> public virtual void ResumeInfo(LabObject info) { transform.position = info.Position.GetPos(); }