コード例 #1
0
    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);
    }
コード例 #2
0
 public virtual void Copy(LabObject info)
 {
     this.ID            = info.ID;
     this.LabObjectType = info.LabObjectType;
     this.ObjType       = info.ObjType;
     this.Position.Copy(info.Position);
 }
コード例 #3
0
ファイル: EleLine.cs プロジェクト: 741645596/Lab
 public override void ResumeInfo(LabObject Info)
 {
     base.ResumeInfo(Info);
     if (Info != null)
     {
         SetLinkInfo(Info as CircuitObject);
     }
 }
コード例 #4
0
    private void LeftGrabHandler(object sender, ObjectInteractEventArgs e)
    {
        LabObject labObject = e.target.GetComponent <LabObject>();

        if (labObject != null && labObject.ID == ID)
        {
            ReleaseValidChildrenWhenGrab();
        }
    }
コード例 #5
0
 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());
         }
     }
 }
コード例 #6
0
 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);
             }
         }
     }
 }
コード例 #7
0
ファイル: NDLab.cs プロジェクト: 741645596/Lab
    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);
        }
    }
コード例 #8
0
    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;
            }
        }
    }
コード例 #9
0
ファイル: CurrentSourceElement.cs プロジェクト: 741645596/Lab
 public override void ResumeInfo(LabObject Info)
 {
     base.ResumeInfo(Info);
 }
コード例 #10
0
ファイル: MainScript.cs プロジェクト: shikoist/tanks
    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);
    }
コード例 #11
0
ファイル: NDlabObject.cs プロジェクト: 741645596/Lab
 /// <summary>
 /// 撤销重做
 /// </summary>
 /// <param name="timeStr"></param>
 /// <param name="info"></param>
 public virtual void ResumeInfo(LabObject info)
 {
     transform.position = info.Position.GetPos();
 }